Interesting suggestions.
>Do you get the same output for "set" and "env" executed in scripts, as you do at the command line?
No, I do not! Here are the variations between the two:
When executed within the script:
BASH_LINENO=([0]="0")
BASH_SOURCE=([0]="./ztest")
HISTSIZE=1000
IFS='
'
POSIXLY_CORRECT=y
PPID=26545
SHELLOPTS=braceexpand:hashall:interactive-comments
osix
SHLVL=2
_=/bin/sh
When executed at the command line:
BASH_LINENO=()
BASH_SOURCE=()
COLORS=/etc/DIR_COLORS.xterm
COLUMNS=157
HISTFILE=/root/.bash_history
HISTFILESIZE=1000
IFS=$' \t\n'
LINES=71
MAILCHECK=60
OLDPWD=/root
PIPESTATUS=([0]="0" [1]="0")
PPID=26544
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
PS1='[\u@\h \W]\$ '
PS2='> '
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHLVL=1
SUPPORTED=en_US.UTF-8:en_US:en
_=
>Does it make a difference whether you are root or an ordinary user?
No difference.
>What if you make the file write to STDOUT, but use a redirect or pipe on it when you run it? eg. ./foo > foo.out or ./foo |bar {|cat is as good as anything}. Do you get anything then?
Adding the pipe to cat worked....sort of. See the variation below.
[root@responsivedata1 www]# ls -lat
total 228
drwxr-xr-x 10 root root 4096 Jan 17 06:26 .
-rw-r--r-- 1 root root 903 Jan 17 06:26 zresult
-rwxr-xr-x 1 root root 19 Jan 17 06:23 ztest
-rw-r--r-- 1 root root 67 Jan 13 18:08 stdout
-rwxr-xr-x 1 root root 60 Jan 13 17:38 untar.sh
-rw-r--r-- 1 root root 100620 Jan 13 17:29 intranet.tar.gz
drwxr-xr-x 10 apache apache 4096 Jan 12 11:02 intranet
drwxr-xr-x 2 apache apache 4096 Jan 3 16:06 responsivedata
drwxr-xr-x 14 root root 12288 Jan 2 11:43 manual
drwxr-xr-x 3 root root 4096 Jan 2 11:42 icons
drwxr-xr-x 3 root root 4096 Jan 2 11:42 error
drwxr-xr-x 2 webalizer root 4096 Jan 1 04:02 usage
drwxr-xr-x 25 root root 4096 Aug 23 18:03 ..
drwxr-xr-x 2 root root 4096 May 23 2005 cgi-bin
drwxr-xr-x 2 root root 4096 May 23 2005 html
[root@responsivedata1 www]# ./ztest | cat
total 220
drwxr-xr-x 10 root root 4096 Jan 17 06:26 .
-rw-r--r-- 1 root root 903 Jan 17 06:26 zresult
-rwxr-xr-x 1 root root 19 Jan 17 06:23 ztest
-rw-r--r-- 1 root root 67 Jan 13 18:08 stdout
-rwxr-xr-x 1 root root 60 Jan 13 17:38 untar.sh
-rw-r--r-- 1 root root 100620 Jan 13 17:29 intranet.tar.gz
drwxr-xr-x 10 apache apache 4096 Jan 12 11:02 intranet
drwxr-xr-x 2 apache apache 4096 Jan 3 16:06 responsivedata
drwxr-xr-x 14 root root 12288 Jan 2 11:43 manual
drwxr-xr-x 3 root root 4096 Jan 2 11:42 icons
drwxr-xr-x 3 root root 4096 Jan 2 11:42 error
drwxr-xr-x 2 webalizer root 4096 Jan 1 04:02 usage
drwxr-xr-x 2 root root 4096 May 23 2005 cgi-bin
drwxr-xr-x 2 root root 4096 May 23 2005 html
?--------- ? ? ? ? ? ..
[root@responsivedata1 www]#
Not sure why I am getting the line with '?'
>Do you get the same sorts of issues with an SSH session as with a keyboard and monitor plugged right into the machine?
No difference.
>Something somewhere is definitely set up funny your end
Agreed.
And I really appreciate the suggestions you are giving me.
My attention is drawn to the variations between the set values for:
SHELLOPTS
SHLVL
I'll do some research as to what these are controlling.
But the question is how do I modify their settings?
Did I miss these in the /root/.bashrc file?
Thanks,
Sean McCoy
sean@responsivedata.com