Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #12120
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Strange Problem with 'test' or '[' |
| Date | 2015-12-23 10:20 -0500 |
| Message-ID | <mailman.457.1450884050.843.bug-bash@gnu.org> (permalink) |
| References | <567A76EB.1000506@bytec.de> <20151223140901.GG27325@eeg.ccf.org> <567AB838.5050706@bytec.de> |
On Wed, Dec 23, 2015 at 04:05:28PM +0100, Bytec GmbH - Helmut Koeberle wrote:
> OK, with '[[' ist's working!
>
> if ([[ "true" = "true" ]] && [[ "${h:0:1}" = "/" ]]); then echo slash; fi
You don't need parentheses around it. The parentheses force the commands
to run in a subshell (fork()), so it just slows things down.
> if [[ "true" = "true" ]] && [[ "${h:0:1}" = "/" ]]; then echo slash; fi
This is fine, but also note that you can put && inside [[ if you wish:
[[ "true" = "true" && "${h:0:1}" = "/" ]]
Or you can use pattern matching:
[[ "true" = "true" && $h = /* ]]
Back to gnu.bash.bug | Previous | Next | Find similar
Re: Strange Problem with 'test' or '[' Greg Wooledge <wooledg@eeg.ccf.org> - 2015-12-23 10:20 -0500
csiph-web