jond
2005-05-05, 12:04 PM CDT
I have 2 scripts. I want one scripts output to feed the other script with input.
I'm trying to do it like this with script2 using a $1 variable but its
not working:
script1.sh | script2.sh
The first script just outputs a continous stream of IP addresses. The second script should check each ip address to see if it exists in a text file, and if not, add it to the text file.
Any ideas?
This is script1:
ngrep -q host 10.10.10.3 | sed -e 's ^T '| cut -d: -f1
This is script2:
grep "$1" /tmp/list.txt
if [ "$?" = "1" ]; then
echo $1 >> /tmp/list.txt
echo "$1 is new"
fi
I'm trying to do it like this with script2 using a $1 variable but its
not working:
script1.sh | script2.sh
The first script just outputs a continous stream of IP addresses. The second script should check each ip address to see if it exists in a text file, and if not, add it to the text file.
Any ideas?
This is script1:
ngrep -q host 10.10.10.3 | sed -e 's ^T '| cut -d: -f1
This is script2:
grep "$1" /tmp/list.txt
if [ "$?" = "1" ]; then
echo $1 >> /tmp/list.txt
echo "$1 is new"
fi