I am starting to code a few ideas of customization and tasks improvements on the office UNIX machine. My first script (see below) only contains ALIAS commands. But for some reason, when I execute it, the alias are not executed. I suspect it is because of the "#!/bin/ksh" not being recognized or something.
Unix machine is :
Operating system ..: AIX \(64Bit\)
Version / release .: 5.2
using Korn shell
My simple script is :
#!/bin/ksh #set -x
# #--------------------------------
# Alias Script
# created on : Aug-9, 2006
# created by :
# modified on:
#
# description : simply alias commands that I
# need for my work to make it easier #---------------------------------------
alias goto_ae='cd /usr/local/Tivoli/custom/policy'
alias ll='ls -al'
When I execute it ("sh MyAlias.sh"). It ends without any messages nor problems. But when I execute either new alias, they are not recognized. If I define them on the command line the same way they are in my script, it works.
I tried accessing "man alias" but just about every UNIX commands aren't defined in this system's man.
In trying to find the Korn version, I tried these 2 ways found in another thread. Both didn't give me an answer.
>print ${.sh.version}
ksh: ${.sh.version}: 0403-011 The specified substitution is not valid for this command.
>what /bin/ksh | grep Version
>
At logon time I get this as the possible O/S version ?
Operating system ..: AIX \(64Bit\)
Version / release .: 5.2
Accessing the manual on anything is not helpfull as nothing seams to be defined in 'man'.
>man ksh
Manual entry for ksh not found or not installed.
>man ls
Manual entry for ls not found or not installed.
>man ps
Manual entry for ps not found or not installed.
>man cd
Manual entry for cd not found or not installed.
>man
Usage: man [[[-ct] [section]] | [-f | -k]] [-M path] [-r] name...
If I do like you said, I get an error :
>. MyAlias.sh
ksh: MyAlias.sh: not found
I found another script who's first line is '#/bin/ksh' and not '#!/bin/ksh' but using either method simply doesn't work with my script :
>./MyAlias.sh
>ll
ksh: ll: not found
>. MyAlias.sh
ksh: MyAlias.sh: not found
That other script I mentioned actualy works as I ran it last week. Could it be that the problem is isolated to the ALIAS command in scripts ?
In finding other shells I have access to :
>ls /bin/*sh*
...
/bin/bsh
/bin/chsh
/bin/csh
/bin/ksh
/bin/ksh93
...
in /etc/passwd, my ID is there with '/usr/bin/ksh' at the end. So I assume, at logon, I fall into Korn shell ?
Assuming the problem is isolated to ALIAS commands in a shell script, I modified my script to :
#!/bin/ksh #set -x
# #--------------------------------
# Alias Script
# created on : Aug-9, 2006
# created by : fapicard
# modified on:
#
# description : simply alias commands that I
# need for my work to make it easier #---------------------------------------
echo "before alias"
alias goto_ae='cd /usr/local/Tivoli/custom/policy'
alias ll='ls -al'
echo "after alias"
>./MyAlias.sh
before alias
after alias
I executed it and got the echo printouts. So there is a problem with the ALIAS but why ?