[Q] Simple shell script problem??

Michael Velez mikev777 at hotmail.com
Thu Jul 28 23:42:39 UTC 2005


----- Original Message ----- 
From: "mcclnx mcc" <mcclnx at yahoo.com.tw>
To: <redhat-list at redhat.com>
Sent: Thursday, July 28, 2005 5:06 PM
Subject: [Q] Simple shell script problem??


> We have Redhat As 3.4 install ed on server.  I am
> write i simple script and have problem happen.
>
> The  user  login shell is : CSH
>
> the program we try to ru will use : KSH
>
> %pg test1.sh
> #!/bin/sh
> set -v
> echo $SHELL
> export ORACLE_SID = CULNX
>
> %./test1.sh
> echo $SHELL
> /bin/csh
> export ORACLE_SID = CULNX
> ./test1.sh: line 4: export: `=': not a valid
> identifier
>
>
>
> look like "#!/bin/sh"  useless.  Program still use
> "csh" to run it.
>
> Any ideal?
>
> Thanks.
>
>
>
>
>
>
> -- 
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>

The SHELL variable will always have the pathname of your login shell if it 
remains set, regardless of the current shell you're running.  If the SHELL 
variable is set, calling /bin/ksh will not change the value.  If the SHELL 
variable is unset,  #!/bin/ksh will set the SHELL variable to /bin/sh.  And 
actually, if you use #!/bin/sh, the SHELL variable will be set to /bin/bash, 
the Bourne Again SHell. Go figure.

To unset the SHELL variable, type:

unset SHELL

at a command prompt.  After that, your script as it's written will probably 
echo /bin/bash.

As alread mentioned by Mike Ault, remove the spaces on both sides of the = 
sign.

Michael




More information about the redhat-list mailing list