Skip to content

Instantly share code, notes, and snippets.

@gyakkun
Created December 22, 2018 14:44
Show Gist options
  • Save gyakkun/9cb17cd895750da8ea69de79cac241aa to your computer and use it in GitHub Desktop.
Save gyakkun/9cb17cd895750da8ea69de79cac241aa to your computer and use it in GitHub Desktop.
handle_space_in_for_loop_shell_script.sh
#!/bin/bash
IFS=$'\n'
OLDIFS="$IFS"
for i in $(find . -depth -name a.txt); do
rename -v "s/a(?=(\.txt))/b/" $i
# echo $i
done
IFS="$OLDIFS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment