Networker

Re: [Networker] Running mminfo in bourne shell -- SOLVED!

2004-11-02 11:10:08
Subject: Re: [Networker] Running mminfo in bourne shell -- SOLVED!
From: George Sinclair <George.Sinclair AT NOAA DOT GOV>
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Date: Tue, 2 Nov 2004 11:12:28 -0500
Hmm ... well, good thing I wasn't applying for a job. LOL!!! Too bad
they can't interview based on most insightful question(s) as opposed to
answers. Now, that would be a fun interview. Instead of asking the
interviewee to provide answers to your questions you instead ask them to
provide you the most insightful question they can think of. If you can't
answer it, or more specifically, if you've never heard or read of anyone
ever asking such a question before anywhere, they get the job;
otherwise, you boot 'em out the door. This in fact reminds me of a
Brothers Grimm story wherein this princess claims she can solve any
riddle. She even has sundry tomes and books filled with all kinds of
answers so if she gets in a pinch she can find the answer. Of course, if
she can answer it then something none to kind happens to the person, and
if she can't then ... one day someone proposes a question for which she
has no answer, and she can't find it in her books. Good story.

George

Byron Servies wrote:
>
> On Nov 2, 2004, at 7:14 AM, George Sinclair wrote:
>
> > Thanks to all who responded. It turns out that the solution, as many
> > have suggested, is to simply use double quotes. What was confusing me
> > was that I was trying to use double quotes inside the single quotes
> > which doesn't work. As others have already said, the shell does not
> > expand the variable when inside single quotes.
> >
> > I was somehow under the impression that the mminfo command required the
> > use of single quotes when using -q or -r, but it appears that double
> > quotes can be used instead. So, something like
> >
> > date=$1
> > mminfo -s server -q "pool=poolname,savetime>=$date"
> >
> > works like a champ, requiring no double quotes on the variable or when
> > passing the variable. But I guess placing double quotes around $1
> > and/or
> > when passing wouldn't hurt.
> >
> > Interestingly, however, I have foud at least one situation where double
> > quotes don't work.
> >
> > The following command runs fine:
> >
> > mminfo -s server -a -r "volume,%used,pool,location" -q '!full'
> >
> > but if I replace the single quotes with "!full" it says:
> >
> > sh: !full: event not found.
> >
> > Now, I guess you'd just have to use an 'if' condition in your script
> > and
> > have each choice hard coded for either 'full' or '!full' rather than
> > having a variable whose value was either 'full' or '!full'. Hmm ...
> >
>
> George, George!  Think!  You post some of the most insightful questions
> on this list and you are falling into the trap of shell quoting.
> Actually, it is subtle, and a question I ask when interviewing unix
> software engineers ("What are the 3 shell quoting symbols and what are
> the differences between them").
>
> Double quotes: the shell evaluates the text within the quotes, performs
> things like variable expansion and history expansion (the ! in your
> example) and passes the result into the program as a single item.
>
> Single quotes: the shell does not interpret the text within the quotes
> and passes it verbatim into the program as a single item.
>
> So, this is why you need single quotes around !full: so the shell does
> not look for a previous command in your history named full.
>
> Back quotes: the shell interprets the text within the back quotes as a
> command, runs the command, and returns the result to the command line
> and continues processing.
>
> HTH,
>
> Byron

--
Note: To sign off this list, send a "signoff networker" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list. Questions regarding this list
should be sent to stan AT temple DOT edu
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

<Prev in Thread] Current Thread [Next in Thread>