I am trying to run a script to make a simple modification to a number of similar files. The sed works, but after it runs and the differences are displayed, the script does not read ans to start a renaming script if the user answered Y or y.
for i in "$@"
do
sed -f myfile.sed $i >$i.new
diff $i $i.new
echo "^[[7my^[[0m to swap files";
read ans
case $ans in
y|Y) setnew $i;;
*) ;;
esac
done
The command line is populated by reading in a list via the xargs command.
Not sure I understand. Is there some context missing? What do you mean by "command line is populated by reading in a list via the xargs command"? Is stdin - which read would read from - redirected to somewhere or coming from the terminal / user keyboard?
User e.g. lsof from another terminal to find out.
I think you are correct that stdin wasn't available from the keyboard.
In a later test, I prepended the script name and a space on fileLocationList and made it executable. After running "fileLocationList" the script paused to read and process ans.