[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash-4 breaks $(<command>) syntax on FreeBSD
From: |
Greg Wooledge |
Subject: |
Re: Bash-4 breaks $(<command>) syntax on FreeBSD |
Date: |
Fri, 13 Mar 2009 08:14:57 -0400 |
User-agent: |
Mutt/1.4.2.2i |
On Thu, Mar 12, 2009 at 05:05:33PM -0400, Gerard wrote:
> #!/usr/bin/env bash
>
> if $(which gpg2); then
> printf "gpg2 located"
> fi
The behavior of which(1) is not reliable across platforms. Since you're
already using bash, you should consider using one of the bash builtins
instead:
if command -v gpg2 >/dev/null; then
if hash gpg2 2>/dev/null; then
if type -P gpg2 >/dev/null; then
http://mywiki.wooledge.org/BashFAQ/081