Quantcast
Channel: When using a variable to set the path, I get "No such file or directory", but works fine otherwise - Ask Ubuntu
Viewing all articles
Browse latest Browse all 3

Answer by mook765 for When using a variable to set the path, I get "No such file or directory", but works fine otherwise

$
0
0

From man bash:

EXPANSION
       Expansion  is performed on the command line after it has been split into words.  There are
       seven kinds of expansion performed: brace expansion, tilde expansion, parameter and  vari‐
       able  expansion,  command substitution, arithmetic expansion, word splitting, and pathname
       expansion.

       The order of expansions is: brace  expansion;  tilde  expansion,  parameter  and  variable
       expansion,  arithmetic  expansion, and command substitution (done in a left-to-right fash‐
       ion); word splitting; and pathname expansion.

As you can see, the tilde expansion is performed before the variable expansion, so if you run cd $CATKIN_WS, the shell will try to find a directory named ~ which doesn't exist.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>