0

I've spent to much time in the DOS world where cd.. (no space) works.

I tried to do the same in ubuntu by defining a bash file in /usr/local /bin called "cl.."

its body is

#!/bin/bash
cd ..

I have chmod +x on the file.

It doesn't work, ubuntu doesn't complain about command not found.

what did I do wrong?

pomsky
  • 70,557
mfc
  • 121

1 Answers1

3

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.

korc
  • 636
  • 5
  • 3