I know this question has been asked several times, but yet I failed to find a suitable solution for me. Consider me somewhat new to it.
I want to change the directory using a variable 'var' in the script file 'test.sh' instead of using cd /dir/dir1/dir2.
Question:
file example: test.sh
#!/bin/bash
var=/dir/dir1/dir2
echo "$var" -> works(displays the value of var)
cd var or cd $var -> none works, either stay in the same directory or shows error directory doesn't exsist
The directory I wanted to use:
/home/username/Downloads
/boot/extlinux
I have already checked various forums or solutions, but none provided the result. Please help me here.