I have a list of about 15 files I want to delete. They’re on their own line in a text file. how can I go about deleting them from the command line in one command string?
I mostly just doing this as a personal exercise in bash scripting. I think I understand the for loop thing, but I don’t know how to read a specific line number from my text file. Do I use head,sed,tr, cut?
rotfl! that was so easy - i didn’t even think of it. Some of the most complex things really aren’t all that complex. I appreciate you taking the time to read and answer this silly post. I hope to learn more about *nix and bash commands and syntax.
to make your script resilient, its still better to follow normal way, ie, to quote your variables. Since you are using bash, the normal way to read files is
while read -r line
do
rm "$line"
done < "file_to_delete_files"