我需要创建一个自动化,它将文件作为输入,并使用它们的位置字符串作为脚本的输入变量。我还需要它在运行脚本之前请求一个字符串。我该怎么做呢?
我想要执行的命令行代码:
convert (file-location) -page '(string)' (file-location)
提前致谢!
答案 0 :(得分:0)
这个怎么样?
#!/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
您一次使用一个文件名调用此脚本,对于该文件,它会要求您输入要使用的字符串。你可以重写它来循环遍历一堆文件。