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-18 21:51

OP here, sorry i had to go run some errands  but I figured it out! The background process thingy was setting the error codes to 255 for some reason making it look like everything was down so i took off the trailing '&' (and the {}'s which i didn't even need in the first place)
... but now its slow as fuck :S

>>4
yes, yes it was. although it would be nice if it functioned also.(

>>5
1. making it a background process made it about 10x faster and the '1>/dev/null' should send stdout to /dev/null.
2. There fucking useful
3. Etc.*

>>6
thanks for the tips

>>7
eat me :)

>>8
gawk; talk; date; wine; grep; touch; unzip; touch; gasp; finger; gasp;mount;fsck; more; fsck; fsck; yes; fsck; fsck; gasp; umount; make clean; make mrproper; sleep

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