1

I have this code:

#!/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

When I run it, it just continues without waiting for my input. I need to copy/past something form ssh output for further action :/

2
  • 4
    change to echo "Put the input: " ; read some_input Commented Jun 1, 2017 at 9:52
  • 1
    You aren't running read at all. Commented Jun 1, 2017 at 13:02

1 Answer 1

3

Change

printf "\nPut the input: " read some_input

to

read -p "Put the input: " some_input

Example

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
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.