Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

A million different version of this have been asked already, but I'm still lost, sorry. Here is some of what I'm getting back...

In a terminal:

$PATH
-bash: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin: No such file or directory

echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin

cd..
-bash: cd..: command not found
share|improve this question

1 Answer 1

up vote 1 down vote accepted

You haven't really asked a specific question but here are some comments that hopefully help you understand what's going on:

ad 1

If you just enter

$PATH

into your terminal the shell expands the variable called $PATH and then attempts to execute its contents which, obviously, doesn't make much sense with regards to $PATH. Try running

$ foo=ls
$ $foo

and you will understand what happens. Note though that in most cases you do not want to store a command in a variable, you will want to read BashFAQ/050 aka I'm trying to put a command in a variable, but the complex cases always fail! to learn a little bit about the edge cases and why this is generally a bad idea unless you know exactly what you are doing.

ad 2

Using echo $var you are printing the contents of the variable $var to the screen. Note that word splitting can occur and usually you will want to quote your variables to avoid this:

$ echo "$var"

ad 3

This does not work because cd is a command (OK, a shell builtin usually) and .. is its parameter and the two need to be separated by whitespace so the shell's parser can pick these up as separate tokens:

$ cd ..

Note that you can set up an alias to make cd.. work:

$ alias cd..='cd ..'

but I would advise against that and learn how to properly use a Unix shell instead of making it mimic DOS.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.