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

bash alias issue

Status
Not open for further replies.

Kiehlster

MIS
Aug 14, 2000
147
US
I'm trying to set up an alias for bash that runs a second command after doing an 'ls -la /path/to/folder'. I have my alias set up like so:

Code:
alias ll='ls -la ${1}; count ${1}'

I find that no matter what I do here, it always lists the current directory instead of the alternative directory when it exists. So when I run 'll' it' lists the files in the pwd and count information from the alternative directory. When I use the following alias, the directory lists correctly:

Code:
alias ll='ls -la ${1}'

In this case it lists the correct directory, but no matter what I do, I can't seem to get the second command to run without screwing up the listing. Is this a bash scripting bug? or is it something I'm just missing?

Steve Kiehl
Web Page Designer - Nanovox Productions
Fantasy Artist - Zeadi
 
Why not create a function instead of an alias ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Didn't think of that. But that does require me to remove some of the system-wide default scripts rather than simply replacing the ll alias for the current user.

Using a function seems to work fine though. However, do you think there's a solution using an alias that will do the same?

Steve Kiehl
Web Page Designer - Nanovox Productions
Fantasy Artist - Zeadi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top