Gentoo Archives: gentoo-user

From: Alex Schuster <wonko@×××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Bash 3.2/3.1 compatibility?
Date: Sat, 10 Nov 2007 12:52:29
Message-Id: 200711101346.33929.wonko@wonkology.org
In Reply to: Re: [gentoo-user] Bash 3.2/3.1 compatibility? by
1 jan.pradac@××××××.cz writes:
2
3 > I have the same problem and I was trying to solve it few weeks ago,
4 > after almost two weeks of searching and compiling I substituted =~ with
5 > expr:
6 >
7 > - orig use with ~= :
8 > # if [[ "test" =~ ".*" ]]; then echo "ok"; fi
9 >
10 > - alternative use with expr :
11 > # export TEST_VAR="test"
12 > # if [[ ${#TEST_VAR} == `expr "${TEST_VAR}" : ".*"` ]]; then echo "ok";
13 > fi
14
15 Or like this:
16
17 match=".*"
18 if [[ "test" =~ $match ]]; then echo "ok"; fi
19
20 Wonko
21 --
22 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] Bash 3.2/3.1 compatibility? Willie Wong <wwong@×××××××××.EDU>