I have a long bash script that essentially installs a bunch of prerequisites for a user; however, I'm trying to figure out why I can't catch their input when they run cat https://www.my-site.org | bash
but if it's run like ./script.sh
then it works fine.
For example, here's my script:
#!/bin/bash
echo " [*] Please do not cancel this script as it is running in the background."
echo " [*] You will receive a message here once the script has completed installing its prerequisites."
read -p " [*] Press enter to acknowledge and continue..."
The read
command works fine if I run the script with ./script.sh
but it doesn't work fine if I cat script.sh | bash
.
Are there any arguments in bash that I should be using in addition to the way I'm using it for this to work properly?
Tried with --
and still no luck:
root@ip-10-20-46-59:~# cat getting_started.sh | bash --
[*] Please do not cancel this script as it is running in the background.
[*] You will receive a message here once the script has completed installing its prerequisites.
root@ip-10-20-46-59:~#