[prev in list] [next in list] [prev in thread] [next in thread]
List: bash-bug
Subject: Re: Strange Problem with 'test' or '['
From: Greg Wooledge <wooledg () eeg ! ccf ! org>
Date: 2015-12-23 15:20:42
Message-ID: 20151223152042.GH27325 () eeg ! ccf ! org
[Download RAW message or body]
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 = /* ]]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic