Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The following Bash script exits after the first read -p line.


echo Put me next to your targeted .sh file!
read -p "Press [Enter] key when placed next to target..."

echo Type your .sh filename (
read target

chmod +x $target
echo Target Converted!
read -p "Press [Enter] key to Exit..."

Could somebody explain why the script exits and how do I prevent it?

share|improve this question

The script exits because of the following error: line 7: syntax error near unexpected token `(' line 7: `echo Type your .sh filename ('

In Bash, and more generally in command line interpreters, some characters are special and have a meaning. ( and ) are two of those characters.

When using echo, read -p or other similar commands, always enclose your strings in quotes, like this:

echo "Put me next to your targeted .sh file!"
echo "Type your .sh filename ("
echo "Target Converted!"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.