0
[email protected],[email protected],[email protected]

I want to write loop in bash script to scroll through each of this host_list & try to grep a particular string '[email protected]'. if its present then return yes or no

3
  • Is there a reason you're using a string variable instead of an array? Commented May 10, 2021 at 19:35
  • host_list=( [email protected] [email protected] [email protected] ) would be more sensible; then you can just for host in "${host_list[@]}"; do ... Commented May 10, 2021 at 19:36
  • In evaluating answers in the linked duplicates, keep BashPitfalls #50 in mind. array=( $string ) is an antipattern -- while commonly used, it introduces bugs. Commented May 10, 2021 at 19:38

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.