Hi All,
I am having trouble getting a script to produce a quoted string for
interpretation by another command.
I often have to start VNC sessions from my workstation to some
user's Windows machine, since my users all roam between many sites
and machine, I have taken to querying our NBNS servers, (samba
nmbd) to find out from which machine they last registered a
username record, (type #03"
So if I want to find user jereme, I can do this:
$ nmblookup -R "jereme#03" -U merlin
And I get back:
querying jereme on 192.168.0.200
name_query failed to find name jereme#03
I wanted to wrap this up in a shell function, (or script), I
started with this on the command line:
$ xvncviewer -bgr233 $(nmblookup -R "jereme#03" -U merlin | sed -e '1d' |awk '{print $1}')
It does what I want, finds the username jereme, extracts the
returned address and starts xvncviewer.
When I try this in a script, I run in to trouble getting it to
produce the string: "jereme#03" (with the quotes) for passing to
nmblookup. I either loose the quotes, or loose the last one ' " '.
More than solving this specific trouble, I was hoping someone could
point out what it is I am missing about string evaluation in the
bash shell.
I have attached the script I have presently, it is broken, this is
what it produces:
$ ~/.bin/vnc_find_user.sh
Find user: jereme
querying "jereme on 192.168.0.200
name_query failed to find name "jereme#03
Thanks for the help, I am headed home to scour "Learning the Bash
Shell" but I was hoping to get some expert advice.
Enjoy the weekend,
jereme
--
+--------------------------------------------------------------+
Jereme Corrado <jereme@restorative-management.com>
Network Administrator
Restorative Management Corp.
gpg: 1024D/9C39E1F0: 8178 3293 4D36 0012 2FAC 8A2B 4767 A3AB 9C39 E1F0
Attachment:
vnc_find_user.sh
Description: Bourne shell script
Attachment:
pgp4KIRXMSXCo.pgp
Description: PGP signature