[CentOS] bash script reading directory with while and do

m.roth at 5-cent.us m.roth at 5-cent.us
Wed May 28 15:40:27 UTC 2014


Elias Persson wrote:
> On 2014-05-28 15:35, m.roth at 5-cent.us wrote:
>> Elias Persson wrote:
>>> On 2014-05-25 12:08, Paolo De Michele wrote:> !/bin/bash
> <snip>
>>>>          tar cfz `date +%F`_$NAME.tar.gz web$NR/
> <snip>
>>>
>> Dumb question: why not
> <snip>
>>       tar -czf /backup/www/test/`date +%F`_$NAME.tar.gz web$NR/
<snip>
>> Why long?
>> <snip>
>
> With long options one can't stick something that takes an argument
> in the middle of a bunch of others (which was the error I thought
> was present here, and would have been the case if your example had
> the options in the same order).
> It's also more readily apparent what the options do, though that's
> not much of an issue for common things like tar or rm. I for one can
> never recall if it's -c or -C that's --reuse-message for git commit.

<shrug> Everybody I know knows the short flags.

However, the point I made in the code snippet was, why copy it to a temp
directory, then tar and compress it, then copy it to another directory,
then remove the copy in the temp directory, rather than just tar and
compress it directly to the target directory? I *did* give the full path
the the target, preceding the final filename.

        mark




More information about the CentOS mailing list