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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to call an alias command

Status
Not open for further replies.

huangwason

Programmer
Oct 10, 2006
21
DE
I alias a command such as
alias ll="ls -l --color=auto"
in my .bashrc file, now I would like to call this alias ll command via a script, but it can not find this alias command, is there a solution for this problem?

Thanks
 
I don't know bash but in ksh you use alias -x or an ENV file.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Your .bashrc is only processed for interactive shells. If you want to force it to be processed by your shell script, add -i to the shebang line.

Also, by default, aliases are not processes in non-interactive shells. You can override this by using the expand_aliases shopt option:

Code:
#!/usr/bin/bash -i
shopt -s expand_aliases
ll



Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top