I'm trying to change the CD to a path stored in a variable. The variable gets its value from text stored in a file.
This gets the value inside the text file:
devdir=$(<\$HOME/devdir.txt)
cd $devdir
Inside the text file is the text: $HOME/bin
The error I get is:
/bin/dev: line 41: cd: $HOME/bin: No such file or directory
This is the result of trying to use the variable, compared to manually typing it:
UPDATE: This is the snippet of Bash given with the improvement given by fabiotk, which seems to yield no result when it is within the script, however it works fine when run in the cmd window...Snippet
Here is the entire script so far: script and here is me running the given line on its own, then running the script showing it doesn't work inside: enter image description here