Skip to main content
Add answer
Source Link

When assigning a value to path, leave off the leading $ sign in the first while loop.

You only need to do: path=$http_path.

Edit

I only realized after I posted that you also want resources to learn bash. I personally found Advanced Bash-Scripting Guide to be useful. It is a bit dated if I remember correctly, but it is more than sufficient. Also #bash on Freenode is a great place. They're not always the friendliest but they are definitely extraordinarily knowledgable.

Also, never be afraid to test out something on the command-line. That's your interactive interpreter (if you've done any ruby or python programming).

Edit 2

The actual problem was that after hitting enter the user wouldn't exit the loop so the code needed to be changed to:

while read path; do
    if [ -z "${path}" ]; then
        clear
        echo "Are you sure you would like to ..."
        read prompt
        if [ -n "${prompt}" ] ; then
            continue
        fi
        path=$http_path
        break
    else
        # etc.
    fi
done

When assigning a value to path, leave off the leading $ sign in the first while loop.

You only need to do: path=$http_path.

Edit

I only realized after I posted that you also want resources to learn bash. I personally found Advanced Bash-Scripting Guide to be useful. It is a bit dated if I remember correctly, but it is more than sufficient. Also #bash on Freenode is a great place. They're not always the friendliest but they are definitely extraordinarily knowledgable.

Also, never be afraid to test out something on the command-line. That's your interactive interpreter (if you've done any ruby or python programming).

When assigning a value to path, leave off the leading $ sign in the first while loop.

You only need to do: path=$http_path.

Edit

I only realized after I posted that you also want resources to learn bash. I personally found Advanced Bash-Scripting Guide to be useful. It is a bit dated if I remember correctly, but it is more than sufficient. Also #bash on Freenode is a great place. They're not always the friendliest but they are definitely extraordinarily knowledgable.

Also, never be afraid to test out something on the command-line. That's your interactive interpreter (if you've done any ruby or python programming).

Edit 2

The actual problem was that after hitting enter the user wouldn't exit the loop so the code needed to be changed to:

while read path; do
    if [ -z "${path}" ]; then
        clear
        echo "Are you sure you would like to ..."
        read prompt
        if [ -n "${prompt}" ] ; then
            continue
        fi
        path=$http_path
        break
    else
        # etc.
    fi
done
Source Link

When assigning a value to path, leave off the leading $ sign in the first while loop.

You only need to do: path=$http_path.

Edit

I only realized after I posted that you also want resources to learn bash. I personally found Advanced Bash-Scripting Guide to be useful. It is a bit dated if I remember correctly, but it is more than sufficient. Also #bash on Freenode is a great place. They're not always the friendliest but they are definitely extraordinarily knowledgable.

Also, never be afraid to test out something on the command-line. That's your interactive interpreter (if you've done any ruby or python programming).