Приведенное ниже эхо постоянно возвращает мне пустую строку.Я не понимаю почему.Разве все в bash не действует как глобальная переменная?
# Deals with all the cases of having a file vs stdin
out_to_file="N"
# Check to see if the user is running a file or just commandline input
if [ $# -ge 3 ];then
out_to_file="Y"
else # The user is not running a file so ask them if they want to output to a file
read -p "Output to a file? [y/n] " out_to_file
fi
echo $out_to_file