Skip to main content
18 events
when toggle format what by license comment
May 23, 2017 at 12:40 history edited CommunityBot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Apr 6, 2017 at 15:01 answer added Stéphane Chazelas timeline score: 1
Mar 23, 2017 at 11:47 comment added JuanD @Philippos you're also right that I could avoid using the array altogether. -Thanks to everyone for their input.
Mar 23, 2017 at 10:44 history edited ilkkachu CC BY-SA 3.0
fix the link, tag with Bash, since it was mentioned
Mar 23, 2017 at 10:43 answer added ilkkachu timeline score: 5
Mar 23, 2017 at 6:49 comment added Philippos I don't understand why you need SRVR_ARRAY at all. Why not do for h in $HOST_NAMES; do ping $h; done?
Mar 23, 2017 at 5:30 comment added JuanD Well, Im embarrassed @MichaelHomer was right. Used SRVR_ARRAY=($HOST_NAMES) and it worked.
Mar 23, 2017 at 5:24 comment added JuanD Havent modified $IFS and writing for BASH
Mar 23, 2017 at 5:23 comment added Michael Homer What shell is your script written for?
Mar 23, 2017 at 5:23 comment added Gordon Davisson @JuanD Have you changed $IFS to something nonstandard?
Mar 23, 2017 at 5:22 comment added Gordon Davisson @JuanD Variable references that are not in double-quotes get split into "words" based on whitespace -- spaces, tabs, and linefeeds. Thus, in SRVR_ARRAY=($HOST_NAMES), the list of host names will be split, and each name stored as a separate entry in the array. As Michael said, try it. BTW, neither is entirely safe if any of the host names might contain whitespace (technically, that means any of the characters in $IFS, which actually might be anything) and/or shell wildcards (*, ?, or [).
Mar 23, 2017 at 5:21 comment added JuanD No dice. Even tried using double quotes instead of single quotes when setting the HOST_NAMES environment variable. In both cases, it resulted in the first array index location having the entire string server1 server2 server3
Mar 23, 2017 at 5:17 comment added Michael Homer Try it and see.
Mar 23, 2017 at 5:12 comment added JuanD Until I parse through the $HOST_NAMES variable it is one long string. Thats why I had to feed it to AWK
Mar 23, 2017 at 5:06 comment added Michael Homer What's the (practical) difference between that and SRVR_ARRAY=($HOST_NAMES)?
Mar 23, 2017 at 4:57 history edited JuanD CC BY-SA 3.0
edited body
Mar 23, 2017 at 4:42 review First posts
Mar 23, 2017 at 4:45
Mar 23, 2017 at 4:38 history asked JuanD CC BY-SA 3.0