Re: swith user to a bash user
[email protected] (Bob Proulx) Mon, 6 Oct 2003 10:37:01 -0600
| Newsgroups | gmane.comp.gnu.sh-utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
Nicola Lodato wrote: > I've a user /test /that has a /bin/bash shell. In his .profile file > there is these lines: > ODSRELEASE=/some/dir/ > export ODSRELEASE > > When, as user root, I try this command: > > su - test -c "echo $ODSRELEASE" You are getting confused about shell command line quoting. The $ODSRELEASE is getting expanded by *your* shell inside the double quotes and the sub-shell is never even getting the query. It is only seeing an empty echo command. Try this instead. su - test -c 'echo $ODSRELEASE' or su - test -c "echo \$ODSRELEASE" Use 'echo' again to see what the expansion of the command line looks like. echo su - test -c "echo $ODSRELEASE" echo su - test -c 'echo $ODSRELEASE' echo su - test -c "echo \$ODSRELEASE" Bob