nslookup script but having syntax issues


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting nslookup script but having syntax issues
# 1  
Old 07-21-2010
nslookup script but having syntax issues

Hi All
i am creating a script to perform a nslookup on a specified host (so in otherwords it will be: zong(script name) 172.x.x.10(ip adress). i am scripting in tcsh. unfortunately i think i am doing something wrong as it keeps giving me syntax error. can someone help?


Code:
@ num=1
set arg='ping 172.x.x.$num'
while ($num  < 10)
    if (  "$arg" = "172.x.x.$num") then
    if ("`nslookup 172.x.x.$num | grep find`" != "")  echo "172.x.x.$num"
    endif
   @ num++
 end

thank you

Brian

Last edited by pludi; 07-21-2010 at 05:37 AM.. Reason: code tags, please...
# 2  
Old 07-21-2010
Code:
#!/bin/csh
@ num=1
set arg='ping 172.x.x.$num'
while ($num  < 10)
    if ("$arg" == "172.x.x.$num") then
       if ("`nslookup 172.x.x.$num | grep find`" != "")  then
          echo "172.x.x.$num"
       endif
   endif
   @ num++
 end

# 3  
Old 07-21-2010
well quite proud i had it really close... thank you very much Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Nslookup on a variable inside script not working

I am new at scripting. I have a file that each line is the shortname for a server. ie - Server1 Server2 Server3 I want to read in that file, do a nslookup and print the FQDN to a file. I added an echo statement to make sure my variable was being read and changing. But the nslookup... (5 Replies)
Discussion started by: kellyhkc
5 Replies

2. Shell Programming and Scripting

Script: nslookup few hosts at once

Hi Expert, Is there anyway for me to nslookup more than one host at one time, instead of doing it one by one. Thank you. (2 Replies)
Discussion started by: regmaster
2 Replies

3. Emergency UNIX and Linux Support

Nslookup!!! Please look up!!!

Hi all Nslookup command returns!!!! Code: nslookup 10.91.44.29 Server: 127.0.0.1 Address: 127.0.0.1#53 29.44.91.in-addr.arpa name = station1.example.com Code: nslookup station1.example.com Server: 127.0.0.1 Address: 127.0.0.1#53 Name: ... (4 Replies)
Discussion started by: anishkumarv
4 Replies

4. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

5. Shell Programming and Scripting

nslookup: am I doing it right?

Hi guys, I'm back to get some help again :) I have a file that has a list of IP addresses, and I use nslookup in my script to resolve hostnames of those IPs. the problem I'm facing is that I not all the hostnames got resolved! and I don't know why. sometimes the same duplicate IP returns a... (8 Replies)
Discussion started by: Abdulelah
8 Replies

6. UNIX for Dummies Questions & Answers

creating script to perform a nslookup on all servers

Hi All i am trying to create a script (in tcsh) to do a nslookup on all the hosts i have here... can anyone help me? Kind regards. Brian (7 Replies)
Discussion started by: brian112
7 Replies

7. Shell Programming and Scripting

for / foreach syntax issues (in bash or tcsh)

So I am new to unix, and actually anything outside drag and drop with the mouse (been learning for about a week so far) . I have been using the foreach command in tcsh because I am working on a group of files. Basically what I need is to insert part of the filename as the first line in the file.... (0 Replies)
Discussion started by: thepolypore
0 Replies

8. Shell Programming and Scripting

Script Help - Syntax Issues

I have the last portion of an Open Step ping server shell script that is giving me issues that I need to adapt to Ubuntu 8.10 Client flavor of Unix. Can someone see what is wrong with the following: # if there are servers that just went down or came back up, notify # with high importance if ;... (3 Replies)
Discussion started by: gbxfan
3 Replies

9. Solaris

nslookup issues urgent

bwadmin@as1$ nslookup as2.synapse.com *** Can't find server name for address 192.168.0.16: No response from server *** Can't find server name for address 192.168.0.17: No response from server *** Default servers are not available /etc/resolv.conf have already 192.168.0.16/17 defined. I... (2 Replies)
Discussion started by: sandeepsudeep
2 Replies

10. Shell Programming and Scripting

NSLOOKUP script

Hi Anyone know of a quick and simple way to script an NSLOOKUP's from a list/text file? Thanks, Gav (1 Reply)
Discussion started by: gavcollins
1 Replies
Login or Register to Ask a Question