Skip to content

Instantly share code, notes, and snippets.

@jahewson
Created December 14, 2011 12:55
Show Gist options
  • Save jahewson/1476464 to your computer and use it in GitHub Desktop.
Save jahewson/1476464 to your computer and use it in GitHub Desktop.
loop over files in Bash, splitting filename and extension
# filter for .c files
for f in *.c
do
#filename
echo $f
# filename without extension
echo ${f%.*}
# extension
echo ${f#*.}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment