Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Ilkka Virta Newsgroups: gnu.bash.bug Subject: Re: built-in '[' and '/usr/bin/[' yield different results Date: Tue, 13 Nov 2018 19:54:28 +0200 Lines: 36 Approved: bug-bash@gnu.org Message-ID: References: <5b86cf1c-d39a-befc-9734-5be8abd5cddd@heinzerling.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1542131709 11875 208.118.235.17 (13 Nov 2018 17:55:09 GMT) X-Complaints-To: action@cs.stanford.edu To: Service , bug-bash@gnu.org Envelope-to: bug-bash@gnu.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 In-Reply-To: <5b86cf1c-d39a-befc-9734-5be8abd5cddd@heinzerling.com> Content-Language: en-US X-SASI-RCODE: 200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; h=subject:to:references:from:message-id:date:mime-version:in-reply-to:content-type:content-transfer-encoding; s=smtp; bh=1b/8XSpovJO8gvBUAWlRnmbuHEjAdt1QnzC3h2RCOhs=; b=TlYurk1CN2O9QFL4IMWu+rNYiF/s8kwNUwjzFFuc+tM8BEgqaqmK33Adr+dYbnzh5lQUosg/P5LMZ66QSbIyxlUTVSAkJKbdCqnf0D8g/avbLcXBIKXonXPH59VJrLgZ8Hny8jjY0Lm1GD5KlhToBhCVwpUzJaEtF+jXxXA6uU9gubQNXrTyis0y1YB+JDSQ7CgrwpXtEPjMtXr0Was35/mwCROoBmaUFY4TlCq1kEIqfZzbZaWDFoGd80T5G7ZD5fkRmw5Sw0ESn1LZQwwc2nuCA2ZSJ9ZpGMsJhkr1tL4HXia6pQ/cXPxhuTertM/UcHcxAmY4IoQG2GgJ2gjroQ== X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 157.24.2.104 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14815 On 13.11. 18:29, Service wrote: > =C2=A0=C2=A0 =C2=A0# Put the above commands into a script, say check.s= h > =C2=A0=C2=A0 =C2=A0# Run with: /bin/sh < check.sh > =C2=A0=C2=A0 =C2=A0# Or=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 : /bin/sh ./chec= k.sh > =C2=A0=C2=A0 =C2=A0# Or=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 : /usr/bin/env .= /check.sh >=20 > =C2=A0=C2=A0 =C2=A0# Output is always not ok: > =C2=A0=C2=A0 =C2=A0not_nt > =C2=A0=C2=A0 =C2=A0nt $ cat check.sh export PATH=3D"" /bin/touch file1 /bin/rm -f file2 if [ file1 -nt file2 ]; then echo nt; else echo not_nt; fi if /usr/bin/[ file1 -nt file2 ]; then echo nt; else echo not_nt; fi $ bash ./check.sh nt nt $ /bin/sh ./check.sh not_nt nt Isn't that Windows Linux thingy based on Ubuntu? /bin/sh isn't Bash by=20 default on Debian and Ubuntu, so it might be you're just not running the=20 script with Bash. --=20 Ilkka Virta / itvirta@iki.fi