views:

68

answers:

2

i have the following alias set in my .bashrc:

alias la='ls -laG'

but i would really like to issue a command thusly:

la foo/bar

i guess i have to write a shell script? or is there some xargs way?

+4  A: 

This works for me. It will replace la with ls -laG, such that your command will be executed as ls -laG foo/bar.

danben
oops, duhhh ... it actually works
duggi
A: 

For your task you do not need parameters. (Or did I miss something?) However, you could write a shell function that take arguments. I use to have something like

function ccd () { mkdir -p $1 && cd $1; }

in my .bashrc. So I can (c)reate and (c)hange (d)ir in one step by typing

ccd temp1
DerMike