Mac osx terminal commands in an automation
I need to create an automation that takes files as inputs and uses their location string as an input variable to a script. I also need it ask for a string before running the script. How would I go about doing this?
The command line code I want to execute:
convert (file-location) -page '(string开发者_运维百科)' (file-location)
Thanks in advance!
How about this?
#!/bin/bash
if [ $# -ne 2 ]
then
echo "Usage: $0 <path_to_input_file>"
fi
echo "Processing $1. Enter string: "
read a
convert $1 -page "$a" $1
You invoke this script with one file name at a time, for that file it asks you for the string to be used. You could rewrite this to loop over a bunch of files too.
精彩评论