I am trying to use read
command with wget
, for that I am using a simple .sh script:
# echo "Please answer by : -> yes <- or -> no <-"
# read answer
# echo $answer
This code works fine locally, but the read
command failed remotely with wget
, it finishes without waiting an answer:
# wget -qO - 'https://testserver/pub/test.sh' | bash -x
# + echo 'Please answer by : -> yes <- or -> no <-'
# Please answer by : -> yes <- or -> no <-
# + read answer
#
Thank you for your help.
read answer < /dev/tty
bash -c "$(wget -qO - 'https://testserver/pub/test.sh')"
. It won't be great, though, since the allowed length of your script will be capped by the command line's max length.