Hello all,
Please my shell is ksh. I created .profile such that users can pick environments they want to use:
echo Select your Environment!!
echo " 1. Nigeria DEV"
echo " 2. UEMOA DEV"
echo " 3. CEMOA DEV"
echo "Make your choice : \c"
read choice
if [ $choice = 1 ]
then
...
fi
if [ $choice = 2 ]
then
...
fi
Also i have different aliases files for each of those environment:
.aliases_UE
.aliases_NG
.aliases_CE
Please can someone just tell me how to call each aliases of its environment within the if clause ... I have tried using:
if [ $choice = 1 ]
then
...
. .aliases_NG
...
fi
It didn't work.
Thank you.
CarloM
October 17, 2014, 7:39am
2
How didn't it work? Did you get an error, or what?
Hi CarloM,
The aliases doesn't work after the .profile is run. For example, an alias is
alias l='ls -lrt'
. If after you run the .profile, and you do
l
at a prompt, it doesn't list. Same goes for all other alias shortcuts, they don't work.
/finusers/UBADEV> l
ksh: l: not found.
Thanks.
gull04
October 17, 2014, 7:48am
4
Hi,
what do you see if you just type
alias
at a command prompt.
Regards
Dave
cero
October 17, 2014, 8:41am
5
When you say "run the .profile" how did you do this?
You have to source the profile in order to make it affect your current shell (like you did when you invoked the alias scripts in .profile):
. .profile
gull04,
[UBADEVNG/FINCORE]>/finusers/UBADEV> alias
autoload='typeset -fu'
command='command '
functions='typeset -f'
hash='alias -t -'
history='fc -l'
integer='typeset -i'
local=typeset
nohup='nohup '
r='fc -e -'
stop='kill -STOP'
suspend='if [[ ${0#-} = $0 ]] ; then kill -STOP $$; else dspmsg -s 1 ksh.cat SUSPEND "suspend: cannot suspend login shell
"; fi '
type='whence -v'
---------- Post updated at 02:36 PM ---------- Previous update was at 02:35 PM ----------
cero,
yes that's how i ran (or source) the .profile
Ditto
October 17, 2014, 9:54am
7
not much to go on, so just a shot in the dark:
try:
. ./.aliases_NG