on Ubuntu , I try to pause a bash shell script
!#/bin/bash
...
read -n 1 -p"pause"I have seen that syntax everywhere so I don't understand why is it not working
and I get this error
./build.sh: 14: read: Illegal option -nwhat I also don't understand is that in the read man, there are no -n -p options
are there 2 different read commands in linux ?
sheers
11 Answer
read is a bash builtin, that has a -n option.
You are likely running dash which is a simpler shell, where read -n elicits that very error message.
Note that your "shebang" is wrong (!# instead of #!) so you may not be running your script with bash as you expect. In Ubuntu, the default shell (/usr/bin/sh or /bin/sh) is a soft link to dash.