我有这段代码:
#!/bin/bash for some_host in $(cat some_list); do echo $some_host ssh $some_host sudo cat /etc/some.conf |grep -i something_to_grep printf "\nPut the input: " read some_input echo $some_input done
当我运行它时,它会继续而不等待我的输入。我需要复制/过去ssh输出的东西以便采取进一步行动:/
答案 0 :(得分:2)
更改
printf "\nPut the input: " read some_input
到
read -p "Put the input: " some_input
for host in '1.1.1.100' '1.1.1.101' '1.1.1.102'
do
read -p "Enter your input for ${host} " host_input
echo "${host} says ${host_input}"
done