Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am telnet-ing into a Solaris machine and I'm getting the above error with my scripts. I realize this is a common problem, and the solution is to check for the line 'stty erase ^H' within my profile, but I can't find it.

.profile doesn't have any references to stty, and I don't have a .cshrc anywhere. I performed a grep in my home directory, but I came up with nothing.

Is there another source of this problem? All the solutions online refer to either .profile or .cshrc. Thanks.

share|improve this question
up vote 0 down vote accepted

I had this, it was an stty in .kshrc. Remember that .kshrc is sourced on all ksh scripts, interactive and non interactive. If you run a script, stty will still fire, try to work on stdin, which is a file (not a tty now) and fail with an error.

share|improve this answer
I realized that that was the file I needed to look for. Unfortunately, I don't have any traces of it under any home directories or /etc/. I even created my own with "if ( $?prompt && { tty -s } ) stty erase ^?" and various other lines I gathered online with no luck. Any other suggestions? Thanks. – noisesolo Mar 15 '11 at 19:59
I'd do: (1) log in. strace -p <pid of current shell> -o /some/file -f (2) run your script (3) kill the strace (4) use your grep/sed skills to see all the file open()s in the strace log (5) grep through those for stty. I do this regularly when i don't know what's happening. – Rich Homolka Mar 15 '11 at 20:20

To trace your profile, try invoking your login shell with a name beginning with - and with the option -x so that it prints . To find out what your login shell is, run getent passwd $USER; your login shell is the last field on the line (usually /bin/something). To invoke the shell with a name beginning with -, make a symbolic link whose name begins with - and run that. For example, if your login shell is ksh:

ln -s /bin/ksh ./-ksh
./-ksh -x
rm ./-ksh

I'm not sure if this will work with csh. If you don't find anything interesting, look both in /etc and your dot files:

grep stty /etc/* ~/.* 2>/dev/null
share|improve this answer

From csh man page:

A login shell begins by executing commands from the system files /etc/csh.cshrc and /etc/csh.login. It then executes commands from files in the user's home directory: first ~/.tcshrc (+) or, if ~/.tcshrc is not found, ~/.cshrc, then ~/.history (or the value of the histfile shell variable), then ~/.login, and finally ~/.cshdirs (or the value of the dirsfile shell variable) (+). The shell may read /etc/csh.login before instead of after /etc/csh.cshrc, and ~/.login before instead of after ~/.tcshrc or ~/.cshrc and ~/.history, if so compiled; see the version shell variable. (+)

So there are a couple of files where you could find this line

share|improve this answer
I don't have any of those files, and I checked all the files in all the home directories (there are only 4 users on this machine). Also, I was dumb and didn't realize that the specific solutions probably only pertains to csh scripts, but the scripts in question are ksh. Furthermore, I tried adding my own .kshrc file with "if ( $?prompt && { tty -s } ) stty erase ^?" and various other lines I gathered online with no luck. – noisesolo Mar 15 '11 at 17:27

You can also use tty to test for tty: tty -s && stty erase ^H.

tty -s's return code specifies if the current connection is tty or not.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.