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

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

1 Answer 1

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.