I am a beginner in shell scripting. I am trying to change directory in a shell script by passing an absolute path as an argument. I am trying to do it with cd
command but it's not working. Any idea how to specify an absolute path? e.g, currently I'm in /home/malik1
and I want to go to /home/documents
What I've done:
if [[ -d "$1" ]]; then
cd $1
Correct me please if I'm doing it wrong.