View Full Version : [SOLVED] path alias in tcsh
cybo
January 31st, 2009, 05:25 PM
i want to setup a path aliases in my tcsh to several of my dirs. so if i want to go to mydox dir i would type
cd mydox
instead of cd /usr/share/usr_name/dir1/dir2/dir3/mydox
i have a variable for mydox,
set mydox=/usr/share/usr_name/dir1/dir2/dir3/mydox
but it is annoying to type a '$' sign every time i do a cd
cd $mydox
can anyone give any suggestions about how i can setup an alias, so i could do the following
cd mydox
snova
February 1st, 2009, 01:10 AM
I've never heard of such a feature, in any shell. It would probably be very ambiguous...
I would suggest creating a function, or an alias.
alias mydox='cd /usr/share/usr_name/dir1/dir2/dir3/mydox'
Adapt as necessary to fit the proper syntax, I never learned much about CSH and its derivatives.
zpzpzp
February 1st, 2009, 01:56 AM
Type this line in the terminal, or create a shell script of this:
PATH=:/your_folder_path:$PATH
This adds the folder you are interested in to the PATH variable.
And this should allow you to access any files in that folder w/o typing in the full path.
Don't know if this solves your problem.
Paul
snova
February 1st, 2009, 02:01 AM
And this should allow you to access any files in that folder w/o typing in the full path.
PATH doesn't do that; it changes the list of directories the shell searches for executables in. Unless all the files in that directory are programs, changing it wouldn't do much good.
dwhitney67
February 1st, 2009, 02:10 AM
I've never heard of such a feature, in any shell. It would probably be very ambiguous...
I would suggest creating a function, or an alias.
alias mydox='cd /usr/share/usr_name/dir1/dir2/dir3/mydox'
Adapt as necessary to fit the proper syntax, I never learned much about CSH and its derivatives.
+1.
I believe the proper (t)csh syntax does not require the '=' symbol in the statement.
So something like:
alias mydox 'cd /usr/share/usr_name/dir1/dir2/dir3/mydox'
cybo
February 1st, 2009, 04:00 PM
thank you everyone. i got it.
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.