This is the code so far:
#! /bin/bash
index=0
dirs=()
dirs[0]=$(pwd)
size=${#dirs[*]}
dirJump=" "
select choice in quit back jump $(ls -d */); do
echo "###########################################################"
ls -l | egrep -v '^d' | sed -e '1 d'
if [[ $choice == "quit" ]]; then
break
else if [[ $choice == "back" ]]; then
size=${#dirs[*]}
if (( size > 1 )); then
unset dirs[$(( ${#dirs[*]}-1 ))]
cd ${dirs[$(( ${#dirs[*]}-1 ))]}
fi
else if [[ $choice == "jump" ]]; then
echo "Enter a directory to jump to: "
read dirJump
if (( ${#dirs[*]} == 10 )); then
unset dirs[0]
cd $dirJump
dirs[$(${#dirs[*]})]="$dirJump"
else
cd $dirJump
dirs[$(${#dirs[*]})]="$dirJump"
fi
else
echo "do other things"
fi
done
When I test it, I get the error:
./dirNav.bash: line 35: syntax error near unexpected token `done'
./dirNav.bash: line 35: `done'
I thought you had to put "done" at the end of a select. What am I doing wrong?