I have this bash code:
#!/bin/bash
ls "$SOURCE" > cplist.txt
cat cplist.txt | while read FILE; do
echo "Would you like to copy $FILE? y/n"
read ANSWER
if [ "$ANSWER" = "y" ]; then
cp -v "$FILE" ./Destination;
else
echo "File NOT coppied"
fi
done
The idea is to make a list of all files in a folder, then ask the user each file they want to copy to the destination folder. Currently this script wont allow user input after: "would you like to copy $file? y/n". I cant work out why as I'm very new to this kind of thing. Any ideas? Thanks in advance!