Skip to content

Instantly share code, notes, and snippets.

@cflynn07
Last active March 27, 2020 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cflynn07/cd3373b51ef4b1ff04073de42569cacf to your computer and use it in GitHub Desktop.
Save cflynn07/cd3373b51ef4b1ff04073de42569cacf to your computer and use it in GitHub Desktop.
looping over files matching brace expansion
#!/bin/bash
RESULT=$(for file in web/static/images/fullstack-react-time-tracking{"","-1","-2","-3"}.png; do
echo $file
echo -n "before:\t"; du -h $file | awk '{print $1}'
magick convert $file -resize 50% $file
echo -n "after:\t"; du -h $file | awk '{print $1}'
done)
echo $RESULT
echo $RESULT | pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment