I think you are looking for parset
:
checkhost() { piing() { ping -q -c 1 -w 3 -s 10 "$1" >/dev/null } if piing "cen$1"; then echo "+cen$1" else if piing "rh$1"; then echo "+rh$1" else if piing "deb$1"; then echo "+deb$1" else echo "-cen$1" fi fi fi } export -f checkhost parset updown -j0 checkhost ::: {1052..1099} echo "${updown[@]}"
It is unclear to me how the you need the sites to work. If, say, it was simply a domain name to append, you can do:
parset updown -j0 checkhost {1}.{2} ::: {1052..1099} ::: site1.com site2.com site3.com
parset
is part of GNU Parallel. After installing GNU Parallel you need to activate parset
by:
- (permanently)
env_parallel --install
followed by starting a new shell - (this session only)
. $(which env_parallel.bash)
If this is not what you are looking for, I suggest you make a full example that works, but does so in serial.
site$i_down.txt
andsite$i_up.txt