question about ~directories
How do I make a directory on my system accessable from anywhere by the ~mydirectory convention?
I'm sure its easy but I had trouble finding an answer. thanks |
you mean symlinks?
ln -s |
yes but how do I make the link accesable from anywhere?
for example my home directory can be accessed no matter what my current direcotory is by typing cd ~ my mysql directory can be accessed from any directory by typing cd ~mysql I would like a universally accessable link like that but make it something like cd ~mydir -Kalak |
cd is a bash built-in cmd, where '~' means 'home dir of specified user', default 'current user' if none specified.
To emulate that I think you'll have to write a short script and ensure it's always in a dir in your $PATH env variable. If you get it working, post it here, as i'm sure others would like to see it. |
You can achieve what you want without the "~" shell feature.
Just use the CDPATH variable, which allows cd to search for different places when a relative directory is passed. |
Or you could set up alias'??
Type alias at the prompt to see which you already have set-up. |
the CDPATH solution is the closest so far, but not quite right. My CDPATH is empty yet I can still cd to ~mysql or ~vpopmail from anywhere.
anybody know the answer? -Kalak |
Quote:
Quote:
|
Quote:
eg. before I installed vpopmail I could not say > cd ~vpopmail and get to vpopmail. So I know that it is possible to add a new "link" (I quote it because i'm not sure what call it). how do I get a link to mydar so that it can be accessed from anywhere by > cd ~mydir without adding it to a system variable. ~mysql, ~vpopmail, ~games, etc. are not anywhere in the system variables. -Kalak |
Quote:
~someone means someone's homedir Quote:
Quote:
|
Quote:
I knew cd ~username works but I never thought about that. Thanks! -Kalak |
Yes, it's a hack but that's the only way to achieve what you want.
|
Again, why not use alias'???
At the terminal type Code:
alias 'cd ~whatever'='cd /folder/whereever' |
Quote:
Code:
$ bash --version |
All times are GMT -5. The time now is 01:06 PM. |