If we run process in background we see process pid and output:
# echo cho &
cho
19078
Is it possible to make:
# echo cho &
cho
Why I need this?
I want to write simple inline LAN-scanner with only pings for some PC which have no utilities like nmap
or arp-scan
.
for ip in 192.168.1.{1..254}; do (ping -c 1 -t 1 $ip > /dev/null && echo ">>> ${ip} is up"; ) & done
It works but PIDs spoil output.
(echo cho &)
In loop:
for ip in 192.168.23.{1..254}; do (ping -c 1 -t 1 $ip > /dev/null && echo ">>> ${ip} is up" &) done