This is slightly messy to explain.
I have a script that I want to deploy like this:
curl -Ls example.com/myscript.sh | bash
The trouble is the script reads from standard input like so:
echo "You should edit /srv/pillar/tm.sls now. Comments are in the file."
echo Type "skip" to skip or anything else to edit.
read text
if [ "$text" != "skip" ]; then
sudo pico /srv/pillar/tm.sls
fi
Now, since stdin is obviously serving as the source of the script itself, this doesn't currently work. Is there a way I can regain the terminal?
(The current workaround is to deploy it like this: curl -Ls example.com/myscript.sh > myscript.sh && bash myscript.sh
)
Use a process substitution