Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

fucking bash

Name: Anonymous 2009-08-18 18:48

soup /prog/?
I'm trying to lern bash but i fucking suck, can anyone tell me what the fuck is wrong with this script?
inb4 n00b, linux sucks, ect.


#!/bin/bash
TMPFILE="/tmp/$$"
trap "{ rm -f $TMPFILE; exit 255; }" SIGINT SIGTERM EXIT
touch $TMPFILE
for ((i=100;i<116;i++)); do
{ ping -c1 192.168.1.$i 1>/dev/null & }
if [ "$?" == "0" ];then
echo " ■  192.168.1.$i" >> $TMPFILE
else
echo " ■  192.168.1.$i" >> $TMPFILE
fi
done
sleep 2
clear
cat $TMPFILE
exit 0

also is there a simple bash one liner to determine dhcp hostnames?
(first post in the text boards btw, bbcode works here right?)

Name: Anonymous 2009-08-19 6:26

>>11
What you're trying to do can't be done with some kind of IPC.
Here's an idea: fire up ping in the background like you did but invoke it in such a way, that on exit ping writes it's status to a file (you can use one output file per process). You will have to figure out how to gather the results.
Just like a map ping <- foldl

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List