The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-02-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Exporting aliases is shaky at best, and what can be achieved can only be achieved with the Korn shell, not Bourne.

See this.

Here is an excerpt...

Exporting aliases works in much the same way as exporting variables with export. But, ksh will only export an alias to another shell that is not a separate invocation of ksh (an exported alias will survive a fork(2), but not an exec(2)). Exported aliases are available to subshells, for example, ( prog ), and to shell scripts that do not start with #!/bin/*.

You can export aliases interactively or from within your .profile or .kshrc. To do so type, or add to the appropriate file:

alias -x who='who | sort'

Then, when you type alias or alias -x, who=who | sort is shown.

Cheers
ZB