[ale] BASH: how to refer to first word in command line ?
George A. Nies
gnies at mindspring.com
Sun Jun 8 13:55:55 EDT 1997
josin alvistur wrote:
>
> In tcsh I use the following alias to 'cd' to a directory whose
> path is in environment variable 'foo':
>
> setenv foo /users/hoser/a_directory
>
> alias foo 'cd ${\!:0}'
>
> This is convenient, since I can have a large number of directory
> names so mapped, and i only have to remember the environ var. name
> to use the corresponding alias.
I don't have a direct replacement, but I can help you to simplify
changing directories in another way:
Well, there is a Korn shell feature implemented by bash to help you.
There is a shell variable called CDPATH. The values of this variable
are pre-pended to the argument you give 'cd' if the argument is
not a local directory. Like PATH, CDPATH is a colon seperated list.
export CDPATH=/users/hoser
cd a_directory
or an example from my machine:
gateway:/u/gnies > export CDPATH=/usr/lib:/u
gateway:/u/gnies > cd diald
/usr/lib/diald
gateway:/usr/lib/diald > cd gnies
/u/gnies
gateway:/u/gnies > cd httpd
/u/httpd
gateway:/u/httpd >
More information about the Ale
mailing list