开发者

Mac osx terminal commands in an automation

开发者 https://www.devze.com 2023-04-11 05:53 出处:网络
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 abo

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号