#!/bin/bash
a="$1"
i=0
while [ $i < $2 ] ; do
i=$(( i + 1 ))
cp "$a" "${a%.jpg}"$i.jpg
done
Rewrite this in any language please. (Hint for those that don't know bash, $1, $2, $3 and so are arguments given from the command line, basically argv.)
I have all of it written in python except I can't get the damn shutil to accept the value of i as part of the filename, keeps complaining that it needs a string/buffer, and open(filename, 'wb').write(foo) doesn't work.
Name:
Anonymous2013-09-20 16:32
install gentoo
Name:
Anonymous2013-09-20 16:54
while [ $i < $2 ]
What the hell are you doing here? Perhaps you meant $i -lt $2?
#!/usr/bin/env zsh
a=$1
i=0
while [[ $i < $2 ]]; {
i=$(( i + 1 ))
cp $a ${a%.jpg}$i.jpg
}
More seriously:
I have all of it written in python except I can't get the damn shutil to accept the value of i as part of the filename, keeps complaining that it needs a string/buffer
it is my opinion that .format() is overly complicated for uses like above. i believe the py devs were met with backlash at %'s formatting uses: the manual says .format()supplements%, not deprecates