running a command with paramaters it obtains from a file
Hi
How can i run a command and in the middle of it, get text from a file? e.g. i want to call the command: iptables -I FORWARD 10 -p udp -m udp -s READDATAFROMAFILE -d 192.168.1.1 --dport 1111 -j ACCEPT and READDATAFROMFILE should be replaced by the contents of the file "myip" Cheers! |
Code:
iptables -I FORWARD 10 -p udp -m udp -s $(cat /path/to/file.txt) -d 192.168.1.1 --dport 1111 -j ACCEPT |
Oh that's neat :D Thx!
Concerning security... To make a long story short, Im installing port knocking, but it does not have some features i want, so i have to write them myself... and that line will be part of a script where the preceding line retrieves an ip(source ip for the port forward rule) from a server on the internet and puts it in /path/to/file.txt (to follow on from your example)(ie wget -q mysrv.com/myfile) Having said that... what should i put inside "$( )" for it to be replaced by the contents of www.mysrv.com/myfile ? I tried "wget -q -O www.mysrv.com/myfile" but it does not work.... |
Code:
lynx -dump http://www.example.com/myfile |
All times are GMT -5. The time now is 07:19 AM. |