Trying to pass images to shell command using automator
Question
I am creating this service for Finder that will receive image files and pass to a shell command.
The idea is this:
- I select image files on finder.
- I right click and choose the service I am creating
- the service receives the files and passes to sips, so it will scale the images to a given size.
this is how I created it.
sips would run on terminal if I type
sips -z 750 1334 *.png (or any other extension, including *.*)
I am hoping that $* would pass a list of arguments to sips, but this is not working.
How do I do that?
Solution
I found a following solution that works for me:
for f in "$@"; do
sips -z 750 1334 "$f"
done
OTHER TIPS
You're looking for $@
:
sips -z 750 1334 "$@"
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange