This script tries to copy a text file into another directory. I don't understand why I'm having this problem: ./move_in.sh: line 36: ls: command not found It was working ok until I added the if-statements.
update_file=pwd
echo ""
echo "You can move a text file from your PC into the repository"
echo ""
echo "You need to know where is your text file"
cd /
ls
times=1
echo ""
echo "Where is your text file?"
read directory
while [ -d $directory ]
do
echo $times
if [ $times == 1 ]
then
LAST=$directory
fi
if [ $times != 1 ]
then
LAST=$PATH/$directory
fi
cd $directory
ls
echo ""
echo "Where is your text file?"
read directory
PATH=$LAST
echo $PATH
times=$((times + 1))
done
PATH=$PATH/$directory
echo $PATH
open $PATH
cp $PATH /\$update_file
echo "You found the text file!"
exit 0
I want to have the complete path of the file when the process finishes, thats why I used LAST and PATH, and I equalize them.