Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #12120
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: Strange Problem with 'test' or '[' |
| Date | Wed, 23 Dec 2015 10:20:42 -0500 |
| Lines | 18 |
| Approved | bug-bash@gnu.org |
| 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> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | usenet.stanford.edu 1450884050 26444 208.118.235.17 (23 Dec 2015 15:20:50 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash@gnu.org |
| To | Bytec GmbH - Helmut Koeberle <helmut.koeberle@bytec.de> |
| Envelope-to | bug-bash@gnu.org |
| Content-Disposition | inline |
| In-Reply-To | <567AB838.5050706@bytec.de> |
| User-Agent | Mutt/1.4.2.3i |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] |
| X-Received-From | 139.137.100.1 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.14 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:12120 |
Show key headers only | View raw
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