[CentOS] How to test for '.' in a script
Paul Heinlein
heinlein at madboa.comThu Jul 28 19:58:57 UTC 2011
- Previous message: [CentOS] How to test for '.' in a script
- Next message: [CentOS] kvm module and boot order
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 28 Jul 2011, 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 if [ "$I" = '.' ]; then ... Use a single = rather than -eq (which tests numeric equality) and use single brackets -- or, better, call test directly: if test "$I" = '.'; then ... "help test" is your friend! -- Paul Heinlein <> heinlein at madboa.com <> http://www.madboa.com/
- Previous message: [CentOS] How to test for '.' in a script
- Next message: [CentOS] kvm module and boot order
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the CentOS mailing list