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 only Shell functions. So what am i missing here?Is there a way to explain this discrepancy?
Thanks :),
/bin/sh for POSIX compliant UNIX systems must support aliases - because the POSIX standards require it.
/bin/sh is a POSIX shell, even if it has Bourne shell roots.
1 Like
Thanks Jim . How does find out that a given shell is POSIX compliant? Thanks.
Humm, on 5.3 /usr/bin/sh is the default shell and is a link to the Korn Shell. Check that /bin/sh is not also a link to the Korn Shell.
Thanks Murphy. How do i check this linking of /bin/sh to Korn Shell. I am new to Unix .Is there a command to do so? Thanks.
ls -l /bin/sh
you will see something like this at the end of the line: -> /usr/bin/ksh
the "->" tells you the name of the file the link points to.
most file have something that looks like this: -rwxr-xr-x at the begining of the line output by ls -l. Directories look like drwxr-xr-x links: lrwxrwxr-x. The first character tells you if it is a special type of file, not just a regular file.
Thanks Jim. I found out that on my Unix AIX 5.3 the /bin is linked to /usr/bin so i did the following :
ls -l /usr/bin/sh and i got the following.
-r-xr-xr-x 5 bin bin 290006 Jul 18 2010 /usr/bin/sh
But this still does not show the linking to ksh .So where can i find it?
Thanks,
See the link count of 5. Check link count of and size of /usr/bin/ksh. Are they the same?
Hi Murphy.
I executed the following : ls -l /usr/bin/ksh and the result is this :
-r-xr-xr-x 5 bin bin 290006 Jul 18 2010 /usr/bin/ksh
So this matches the result from ls -l /usr/bin/sh.
I also did a diff /usr/bin/sh /usr/bin/ksh and got nothing. So can i safely confirm that the file usr/bin/sh is same as file /usr/bin/ksh? Therefore the default shell in my case is actually a Korn shell even though the command echo $SHELL output /bin/sh?
Thanks,
Prashant
It would appear that it is the Korn shell.
To be certain, what is the output of the following command?
echo ${.sh.version}
The Output of the command echo ${.sh.version} is :
sh: ${.sh.version}: 0403-011 The specified substitution is not valid for this command.
Thanks.
This expansion only works in ksh93 and it means that you are using a 1988-version of the Korn shell. You can verify this by switching to vi-style command line editing mode and then pressing "CTRL-V" in command mode:
# set -o vi
# <ESC>
# <CTRL>-V
# Version M-11/16/88f
This is the output of an AIX 5.2-shell and shows a 88 version, revision "f".
To partially answer your original question: a POSIX-compliant system (which AIX is) is required to have a POSIX-shell in /bin/sh
. If this is a link to another shell or an original binary doesn't matter. The user just can rely on the fact that issuing "/bin/sh" on the commandline will invoke a POSIX-compliant shell somehow.
What the requirements for a POSIX compliant shell are is laid down in the POSIX standards papers, issued and developed by the IEEE. What that in detail means i don't (read: never wanted to) know as i took IBMs word for their implementation of the shell being POSIX compliant at face value, but you could easily find that out by reading the paper and cross-checking it with the ksh documentation.
I hope this helps.
bakunin
Thanks Bakunin. That was a great explanation.My orginal query has now been answered.