Skip to content

Instantly share code, notes, and snippets.

@niedzielski
Last active September 9, 2019 16:04
Show Gist options
  • Save niedzielski/7732de4e4864f0d394ca0a056bd6b1cf to your computer and use it in GitHub Desktop.
Save niedzielski/7732de4e4864f0d394ca0a056bd6b1cf to your computer and use it in GitHub Desktop.
Some different Bash looping options.
find -not \( \( -name node_modules -o -name .git -o -name dist \) -prune \) -type f -name \*.css|
# a
while IFS= read -r file; do git mv "$file" "${file%.css}.less"; done
# b
xargs -rd\\n -i sh -c 'git mv {} $(dirname {})/$(basename {} .css).less'
time while IFS= read -ru9 -d $'\n' line; do
echo -n "$line"
done 9< <(ls -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment