Last active
August 29, 2015 13:56
-
-
Save javierwilson/9164890 to your computer and use it in GitHub Desktop.
hace algo con archivos que parten un nombre base
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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