The unix shell scripts are quite different from DOS bat files in a sense that they are executed as separate processes, not just loading commands into current command prompt, as it is with windows cmd.exe
What you really want, is actually bash alias or function.
Both alias cd..='cd ..'
and cd..() { cd ..; }
will do the trick, first one defines alias, second a shell function.
In order to make it available in succeeding shells as well, it should be written in to .bash_profile
, .bashrc
or .profile
file in your home directory. Which file exactly, depends on your distribution settings, check man bash
, /etc/profile
and /etc/*bashrc
for details.
man bash
will help you further with available commands.
If you are looking for more user-friendly shell than bash, then I suggest you to look into zsh
package.
~/.bashrc
:alias cl..='cd ..'
– Cyrus Sep 13 '15 at 01:23cd..
as an alias forcd ..
. – David Foerster Sep 14 '15 at 14:01shopt -s autocd
, and then you can run just..
and be done with it. – muru Sep 14 '15 at 14:04