Skip to content

Instantly share code, notes, and snippets.

@javierwilson
Last active August 29, 2015 13:56
Show Gist options
  • Save javierwilson/9164890 to your computer and use it in GitHub Desktop.
Save javierwilson/9164890 to your computer and use it in GitHub Desktop.
hace algo con archivos que parten un nombre base
#!/bin/bash
if [ -z $1 ]; then
echo "Usage: $0 imagefile-42"
exit
fi
pages=4
file=$1
basename=${file%-*}
number=${file#*-}
end=$[number+pages-1]
echo "Your basename is \"$basename\" and your numbers go from $number to $end"
all_files=""
for i in $(seq $number $end); do
current_file="$basename-$i"
all_files="$all_files $current_file"
echo "Do stuff with $current_file"
done
echo "Do stuff with $all_files and output file $file.output"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment