|
||||||
| Forums FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| ARCHIVES - Programming & Scripting A place to discuss website design, programming, shell scripts, etc |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello all,
I have recently started playing around with scripting in linux. I would like to write a small value which would allow me to automatically change from the current directory to the directory defined by the value... for example: Code:
$home=`cd /home/suse/desktop` |
|
|||
|
First of all, you cannot change the directory by assigning to $home. Secondly a cd inside a script cannot change the directory of the outside shell because the change directory is only effective within the script which is a child shell. You have to do it with an alias:
alias cdhome='cd $HOME' |
|
|||
|
Sweet, that worked. Thanks for the quick reply.
Just noticed that this does not work in all terminals, are these commands binded to the terminal where the commands were created? How can you make them also available for all normal users? |
|
|||
|
Quote:
For global aliases you can use the /etc/bash.bashrc file. |
|
|||
|
Cool, thanks for the quick post... I have placed my aliases in the global bash file, but they do not work. Is there a specific place in the config file where I have to place these alias's so it will be reconized?
|
|
|||
|
Quote:
alias ll='ls -l' alias la='ls -a' If /etc/bash.bashrc doesn't work try creating /etc/bash.bashrc.local and using that. I haven't set any gloabal aliases in ages as I usually have different ones for root and user. They may have changed things over the years. If I am wrong I hope someone will correct me so I know. |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|