Jarex
17-06-2007, 11:08
I am trying to make small script like this editing or removing post-firewall:
#!/bin/sh
wget -q -O - ftp://login:pass@ip/log/temp.log > /opt/tmp/test.log
if test -s /opt/tmp/test.log
then echo "file exist, doing nothing..."
else sed -i "3,//d" /tmp/local/sbin/post-firewall
fi
Whenever I check script with sh -x it looks like the else command cannot be done (else sed -i "3,//d" /usr/local/sbin/post-firewall or else rm /usr/local/sbin/post-firewall). Script does not see file "post-firewall" and do not want to edit it.
What am I doing wrong?
#!/bin/sh
wget -q -O - ftp://login:pass@ip/log/temp.log > /opt/tmp/test.log
if test -s /opt/tmp/test.log
then echo "file exist, doing nothing..."
else sed -i "3,//d" /tmp/local/sbin/post-firewall
fi
Whenever I check script with sh -x it looks like the else command cannot be done (else sed -i "3,//d" /usr/local/sbin/post-firewall or else rm /usr/local/sbin/post-firewall). Script does not see file "post-firewall" and do not want to edit it.
What am I doing wrong?