[CentOS] bash script reading directory with while and do

Robert Nichols rnicholsNOSPAM at comcast.net
Wed May 28 19:20:34 UTC 2014


On 05/28/2014 09:58 AM, Elias Persson wrote:
> On 2014-05-28 15:40, Robert Nichols wrote:
>> On 05/28/2014 07:10 AM, Elias Persson wrote:
>>> On 2014-05-25 12:08, Paolo De Michele wrote:> !/bin/bash
>>>     >          tar cfz `date +%F`_$NAME.tar.gz web$NR/
>>>
>>> 3. Your `tar` stanza is wrong (if it's not obvious to you why that is,
>>>        now is a good time to make a habit of using long options
>>>        (e.g. `--gzip`) whenever possible).
>>
>> Actually it is correct, aside from possible whitespace issues with $NAME.
>> It is using an outdated syntax (short options all in a group _without_ a
>> leading "-"), but doing it correctly with the needed option argument
>> following the set of option letters.
>>
>
> I stand corrected. Apparently having the "f" in the middle is not a
> problem with the old syntax.

It's analogous to printf(), where a string with all the format controls
comes first, followed by all of the needed arguments in the needed
sequence. It causes all sorts of weirdness when you get things wrong,
as when unquoted whitespace causes what should have been one argument to
appear as two or more.

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.




More information about the CentOS mailing list