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:byrn...@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:byrn...@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

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Reply via email to