[CentOS] [Fwd: [SOLVED] Re: How to test for '.' in a script]

Thu Jul 28 21:25:38 UTC 2011
James B. Byrne <byrnejb at harte-lyne.ca>



On Thu, July 28, 2011 14:30, James B. Byrne wrote:
> I am trying to check for a single period '.' in a shell variable.
>
> $ I=.
> $ echo $I
> .
> $ if [[ "$I" -eq '.' ]]; then echo true; fi
> -bash: [[: .: syntax error: operand expected (error token is ".")
>
.  .  .
>
> How does one check to see for this in a bash script?


Found it.

if [[ "$I" == './' ]]; then echo match; fi
match


-- 
***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3



-- 
***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3