I have a bash script that I wrote to automate some commands, and one of the first lines in the script isn't working on the computer that it needs to run on. The code is below
#!/bin/bash #some comments read -p 'press enter to begin' echo "Please Wait..." #rest of the script
It is a fairly simple start to the automation script and it works fine on the virtual machine I used to test and run the script, but when the script runs in the working environment it outputs the text
read -p 'press enter to begin' straight to the command line and then stops running; instead of the desired result of a read command with the prompt
press enter to begin, waiting for the user's input, and then echoing
Please wait... while the script runs.
sudo bash ./path/to/file.sh
I am not sure what to do to fix this problem as I can't find anything else about this online.
I've gone through all the basic troubleshooting steps; made sure the file is executable, run while specifying that it is a bash file (it actually wouldn't run without the bash callout), and running the same read command that is in the script directly on the command line (which outputs the desired result of
press enter to begin and waiting for a user input).
Any suggestions? I plan on running the script using the
set -x command when have a chance today or tomorrow.