Linux bash loop code

#!/bin/bash

# we use the $@ so that when we run the script
# like this, script.bash *.jpg
FILES="$@"

#start of the loop
for f in $FILES

do

# to remove the extention from the file use ${f%.*}.jpg
convert $f -quality 100 jpeg/${f%.*}.jpg

done

Keywords: bash linux

blog comments powered by Disqus