[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax Question...

From: Dennis Williamson
Subject: Re: Syntax Question...
Date: Tue, 16 Aug 2011 10:56:24 -0500

On Mon, Aug 15, 2011 at 10:19 PM, Linda Walsh <address@hidden> wrote:
>> How do I determine the location of my script?
>> http://mywiki.wooledge.org/BashFAQ/028
> ???  I don't understand the need for complexity -- what I have works.  Its a
> few
> lines@ most -- I use the same in perl.  has worked for years.  But then I'm
> not running
> the scripts on remote systems via 'ssh'....
> I don't need to fix problems that aren't broken.

The "don't do that" messages in Greg's FAQs are just as important, if
not more so, as the "how to" stuff.

>>> prefix="snapdir/@GMT-"
>>> snap_today="$(date +%Y.%m.%d-)"
>>> snap_prefix="$mp/$prefix$snap_today*"
>>> today_snaps="$('ls' -1 ${snap_prefix} 2>/dev/null |tr "\n" " " )"
>> This one is so bad, I saved it for last. Ack! Pfffft! Wait, what? Why?
>> What the? Huh?
> you left of the lines before it that explain it...(fixed that for ya!)
> for a 'mp'=home, it looks for
>     /home/address@hidden
> w/today's date -- the "*" would match any time.
> 'ls' -1 lists them 1/line, if it isn't found, the errors goto devnull, and
> any filenames
> are put on the same line and space separated and stored in 'today snaps'...
> So...I had 'echo' there, before, but for some reason,, it wasn't expanding,
> so I went
> with 'ls/tr'....tried and true!
> What would you do to search for files w/wild cards and return the output
> in a list?

I don't see any globbing unless it comes in via an argument to that
script. Why do you need it in a list? The only thing you're doing with
that variable is checking to see if the files exist. Please see

Why are there single quotes around ls?

Visit serverfault.com to get your system administration questions answered.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]