I'm trying to change directory in shell script to the one given by the command line argument.
#!/bin/bash
chmod 755 findfn.sh
dir=$1
while [ -d "${dir}" ]
do
cd $HOME/"$1"
done
I've looked at many other posts and tried:
cd "dir"
cd ~/"$1"
cd source "$1"
- Removing
#!bin/bash
- Changing
chmod 755
tochmod 700
, etc
Where am I going wrong?
EDIT Just tried this
alias dirc="cd /home/$1"
echo $PWD
but it still doesnt change directory, it just keeps printing out "/home"