If I understand you right, you need to do something like this: #!/bin/bash HOSTS=`cat hosts.txt` for host in $HOSTS; do nslookup $host >> resolved.txt done; exit 0; Note: I have not actually tested the `cat hosts.txt` piece but it should work, otherwise, somehow get your hosts into a variable. If you know perl, it would be much easier in perl.
Howdy,
In order to run a command form bash fr every file in a directory, let's use tar xzvf for instance, I'd use something like this:
for tarball in ./*.tar.gz; do tar xzvf $tarball ; done
And it would open every tar.gz archive in the current directory.
Now my question is, is it possible to do something like that "for" every line in a file?
In my case, I now have a list of hostnames and I want to run nslookup on each of them with a shell script (so I won't have to do it by hand).
for host in hostnames.lst ; do nslookup $host; done
But obviously I'm going to have to do something more then that in order to feed the hostnames to the shell one at a time.
Possible?
---------------------------------------------------- Jonathan Wilson System Administrator
Cedar Creek Software http://www.cedarcreeksoftware.com Central Texas IT http://www.centraltexasit.com
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/support/faq and the archives at http://lists.suse.com