Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exported aliases 1

Status
Not open for further replies.

vlz

IS-IT--Management
Aug 11, 2002
56
IL
Hi,
I'd like to use exported aliases in the ksh.
What is wrong in my example:
$> alias -x ll='ls -l'
$> alias -x ## I see ll alias in the output
$> ksh
$> ll
ksh: ll: not found

Thanks in advance
Vadim
 
Hi Vadim,
all aliases that you want to use must be defined in your environment (.profile for example) because they are living in shell and subshells, but not in parents shell.
Regards Boris.
 
Exported aliases don't get passed when you invoke a new shell. You can use them in a script though. If you had an executable script called with just...
[tt]
ll
[/tt]
...in it, then you could run the script and the [tt]ll[/tt] would work as long as it was aliased before the script was run.

Hope this helps.

 
So what is the meaning of the -x flag?
How can I use it?
Could you give me an example?
 
Vadim,

From what I understand, the older version of ksh (11/16/88) supported a -x option that exported alias definitions to scripts run by ksh. It appears that the newer versions of the shell do not support this option.

If you only want the alias to appear in your login shell, place the alias definition in .profile.

If you want the alias to appear in each of your subshells, add this line to your .profile:

export ENV=$HOME/.kshrc

...and then add the alias definition to the .kshrc file.


Biker
Systems/Network Administrator
LiveFire Labs - Online UNIX and Linux Training with Hands-on Internet Lab
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top