How to test for '.' in a script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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 ".")

All other variants of this construct, with and without escape
characters, single and double quote combinations, that I can think
of all give exactly the same error.

How does one check to see for this in a bash script?


-- 
***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB@xxxxxxxxxxxxx
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@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux