Hi
Linux
Set up - alias ls='ls -l'
Then run script
#! /bin/ksh
sub()
{
ls
}
sub
Is there any way to get it working. I don't want to define alias inside of the program
Thank you
Hi
Linux
Set up - alias ls='ls -l'
Then run script
#! /bin/ksh
sub()
{
ls
}
sub
Is there any way to get it working. I don't want to define alias inside of the program
Thank you
Because you are running this in a new shell (#!/bin/ksh), the alias won't be present. You could run it in your current shell instead though:
. ./scriptname
Of course this means you are very dependent on the environment and the script will behave unexpectedly if someone else runs it.
Thanks
---------- Post updated at 04:34 PM ---------- Previous update was at 03:54 PM ----------
It means that there is no way to set up alias globally which is inherited by child shell.
say
I set it up in the beginning of the scrips
#!/bin/ksh
alias ls='ls- l'
ls # <--works fine here
# call another script .. and alias won't be working there
Check_Alias.ksh
Is there any work around to make it global ?