Amanda-Users

Re: Another oddity from Gene

2009-10-19 11:22:29
Subject: Re: Another oddity from Gene
From: Gene Heskett <gene.heskett AT verizon DOT net>
To: amanda-users AT amanda DOT org
Date: Mon, 19 Oct 2009 11:14:03 -0400
On Monday 19 October 2009, Paul Bijnens wrote:
>On 2009-10-19 16:34, Gene Heskett wrote:
>> On Monday 19 October 2009, Dustin J. Mitchell wrote:
>>> On Mon, Oct 19, 2009 at 8:05 AM, Gene Heskett <gene.heskett AT verizon DOT 
>>> net>
>>
>> wrote:
>>>>        if [`/bin/ls /dumps`]; then   <<<<<----line 173
>>>
>>> This can be a bit tricky in portable shell, but maybe this is closer
>>> to what you want:
>>>
>>> if [ `/bin/ls /dumps` != '' ]
>>>
>>> Dustin
>>
>> I'll try that, but IIRC if the dir is empty, ls still returns a linefeed.
>> brb.
>> Nope, tried with !='' and !='\n', with almost the same result, the diff
>> being that now the error message on the console is minus the ending ]
>> now.
>>
>> ./flush.sh: line 173: [20091019011512: command not found
>
>In portable shell, there must be space before and after the '[' and ']'
>as well as before and after the comparison operator.

Bingo! Its running normally with the original syntax. And I would be willing 
to bet that many of the conditionals in that script which have the same basic 
syntax had to be surrounded by [[ and ]] to make them work right, right?  
Same reason.

And I see an error message in the log that isn't, time to print that script 
and recheck the conditionals.

Thank you Paul.

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
The NRA is offering FREE Associate memberships to anyone who wants them.
<https://www.nrahq.org/nrabonus/accept-membership.asp>

Your modem doesn't speak English.

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