I am trying to loop through all files located in a directory ending in .txt and rename them (replacing beginning with end). However I would like to take the output from this for loop and pipe it to a bash file so that I can check the file and make sure what I have written does what I want it to, then I can just execute the .bash file if what I see fits the task. I've tried
for file in *.txt ; do mv $file ${file//beginning/end} ; done | rename.bash
however this renamed the file and created an empty rename.bash