This is partly because I have a very shallow understanding of BASH.
Here is the script:
eighteen=(2018*/*)
newe=`echo "$eighteen" | sed -e 's/\(-\)*$//g'`
while read f <&3 && read nf <&4; do
mv -v "${f}" "${nf}"
break
done 3<"$eighteen" 4<"$newe"
I am trying to compensate the lousy script I wrote, and delete - symbol at the end of each filename in multiple subfolders.
and the error I get: ./cleanup.sh: line 16: 2018-08-13/untitled-102.arw: No such file or directory
It is worth to note, that the error comes not from mv line, but from this: done 3<"$eighteen" 4<"$newe".
I copied the while loop from the answer on StackExchange. Quick food, usually, is not good for digestion, and quick solutions - for understanding, please help me to understand. Give me a hint on how previously mentioned substitution 4<"$newe" nf <&4 is called, how should I search to learn more about it. Is it applied outside while statement context?
There are other tools with the same name which may or may not be able to do this, so be careful.
whileloop doesn't look right here. This Q&A might help: unix.stackexchange.com/questions/19654/… The error you are seeing looks to be due to<"$var"which perhaps should have been<<<"$var".glob, then call the variable as$eighteen, but it's not a simple variableIO redirections(>&4...) for this simple tasks. Copying without understanding is randomly useful