Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi, sea.
Quote:
Originally Posted by sea
Well, echo $SHELL will print the active shell.
...
I'm not sure what you mean by active shell. I think of the value of environment variable SHELL as the path of the login shell. Here are several invocations of shells and the value of variable SHELL:
It worked this way on Debian (as shown), CentOS, Fedora, Slackware, OS X.
Finally, "echo $SHELL", is also an incorrect way to identify what shell you are running, This command will tell you the user's default shell, i.e. the one defined in the passwd database.
No. The SHELL var, where used/understood just says what shell to use if needed (e.g. .a sub shell created from another process). Doesn't have to be the shell defined in user's passwd entry at all, in fact has better chance of being set by the shell itself.
Jilliagre is right. E.g. bash sets SHELL to the user's default shell if not yet set.
The old Bourne shell does not do that, but these systems use the login program - that does it.
And you are right, too. Once SHELL is set (automatically or manually), many tools (e.g. shell-terminal) open this shell.
--
Traditionally /sbin contained statically-linked binaries. At that times /usr was a separate partition or even a separate disk. If /usr failed and the kernel could load from / then it was good to have statically linked tools under / , without the need of the /usr/lib/*.so
Indeed Solaris 9 and older have
For each fix in one of the shared libraries Sun had to provide a new /sbin/sh (to also contain the fix). This was cumbersome.
Solaris 10 changed to
And in Solaris 11 Oracle has given up the Bourne shell
This User Gave Thanks to MadeInGermany For This Post:
The primary purpose of /sbin is system recovery. Of course it is used by the "superuser".
Following that sense /usr/sbin was created with further "superuser" tools (dynamically linked).
BTW Solaris 11 has
And all Solaris have Now even RHEL 7 joins in - what a relief!
The /bin /usr/bin /sbin /usr/sbin "quadriga" is quite common in Unix,
Portable shell scripts should start with
and then use simple commands.
I have seen a thousand scripts that have adventurous workarounds (e.g. manually trying each command with various pathnames, storing them in variables or even in arrays - disgusting!).
This User Gave Thanks to MadeInGermany For This Post:
I have a loop with cases
I am working on Bourne shell
for file in *.${Today}*.csv *.${Today}*.txt\
do
case ${file} in
sun_detail)
do something
;;
sum)
do something
;;
mod)
do something
;;
*)
do something
;; (5 Replies)
I have several shell scripts which contain the nawk command.
Here is what i m doing assign the correct value to nawk as nawk is not found on a new systems.
Here is what i did.
more test.sh
] && alias nawk=/usr/bin/gawk
] && alias nawk=/usr/bin/nawk
] && alias nawk=/usr/bin/awk... (7 Replies)
Hi,
I'm on Solaris (SunOS wsp2cm01 5.10 Generic_150400-10 sun4v sparc SUNW,Sun-Fire-T200). Trying to set up an alias like below -
alias grep="/usr/xpg4/bin/grep"but when I call grep in my command it ignores my alias & uses /usr/bin/grep instead. The problem with /usr/bin/grep is that it doesn't... (24 Replies)
Iam facing some strange issue with alias. I have an alias file in which i have created lot of aliases as given below.
export BUILD_HOME=/apps/psr/build
export DB_HOME=/apps/psr/database
export LOGS_HOME=/apps/psr/logs
export BUILD_TEST=/apps/psr/build_dev/build_test
export... (0 Replies)
Hi
My Unix sever is AIX 5.3. My Login shell ( using echo $SHELL) is /bin/sh implying it is a Bourne Shell. My Question is that i am still able to use Alias command to create/retrieve aliases. I have read in several sites on Unix online that the Bourne Shell does not support Aliases but... (12 Replies)
Hello, I am trying to set an alias in my .kshrc or .profile and when I do it is not setting. If I do it manually it works fine. Is there another file I should put this in? Here is the alias I am using.
alias ll='ls -ltr'
I am using solaris 9. When I type alias it does not show these... (5 Replies)
Hi All,
PF below details,
> cat run.sh
#!/usr/bin/ksh
alias ll="ls -l"
> ./run.sh
> ll
ksh: ll: not found.
Pls help on this?
Thanks in Advance,
Naga :cool: (2 Replies)
Bourne: How to invoke an alias from within a shell script
If I type in the alias in the command line, it runs
If I insert that same alias into my shell script and run the shell script, the alias is not invoked.
Help please. (2 Replies)
This code has worked for years and still does in my production environment. But it's failing in my development environment now. The cd works but the creation of node1, jnum, and node2 fails. Oddly the output shows a line from from the awk script at the end of the code during the setting of each... (6 Replies)