Fred Weinhaus writes:

> Note that the following looping constructs do not work on the Mac.
>
>   for i in `seq 1 300`; do
> ...
> done
>
> There is no seq command on the Mac OS

I wonder why they die not include that. If one wants it anyway, it is part 
of the GNU coreutils, which can be downloaded from 
<http://www.gnu.org/software/coreutils/>. After compiling, the sed binary 
can be copied to somewhere in the $PATH.

> for i in {1..300}; do
> ...
> done

This works for bash >= 3.2. "bash --version" or "echo $BASH_VERSION" 
prints the version.


> The only ones that i have found that work on Mac OS are
>
> i=1
> while [ $i -le 300 ]; do
> ...
> i=`expr $i + 1`
> done

bash can understand arithmetic statements in (( )) brackets, so [ $i -le 
300 ] can also be written as (( i < 300 )). And i=`expr $1 + 1` can be 
i=$(( i + 1 )) or simply (( i++ )).


The thread looks a little off-topic, but on the other hand a powerful tool 
like imagemagic can be made even more powerful with a little knowledge of 
shell scripting. In case someone got interested, I suggest the Advanced 
Bash Scripting Guide at <http://tldp.org/LDP/abs/html/>.

        Wonko
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to