I want to download a provisioning script that reads some configuration parameters via read, and execute it:
curl http://example.com/provisioning.sh | sh
The problem is, that the read command in the script is call with the -i parameter to provide a default:
read -p "Name: " -i joe name
echo $name
If I download the script, set the +x permission and run it, everything's fine.
If I run it with cat provisioning.sh | sh or sh provisioning.sh, it fails with:
read: Illegal option -i
Why wouldn't read support providing a default if it's run via sh?
But whatever, I'll remove the -i, being left with
read -p "Name: " name
echo $name
Now if I run the script via cat provisioning.sh | sh, it won't do anything. Why is that?
Ubuntu 14.04.