From owner-freebsd-questions@FreeBSD.ORG Sun Aug 26 21:16:21 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F17F016A49A for ; Sun, 26 Aug 2007 21:16:21 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 4B98B13C458 for ; Sun, 26 Aug 2007 21:16:21 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) by smtp.infracaninophile.co.uk (8.14.1/8.14.1) with ESMTP id l7QLGEci050679; Sun, 26 Aug 2007 22:16:16 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1188162976; bh=RcNd7GyvrGDOvU 1to7WFSGy5VrKIIqa8oFnbMMNgdvo=; h=Message-ID:Date:From:Organization: User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To: X-Enigmail-Version:Content-Type:Content-Transfer-Encoding:Cc: Content-Type:Date:From:In-Reply-To:Message-ID:Mime-Version: References:To; b=g4/Ct4EqHjhAbIekNywfbtiApR0yOMbb3d1GHq451H1w2Nswv eyV5m1tuyqPMhAERgHKESc924YzQYz8waPvowXQ/Xu6nh4FZi26MUDEfI85vzN+kxCB lyxQt92Ye35ehHbVT8lxJwoCttDqAv/0I+5QQie/l3A07OBpCq4H8DE= Message-ID: <46D1ED9E.4050809@infracaninophile.co.uk> Date: Sun, 26 Aug 2007 22:16:14 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.6 (X11/20070803) MIME-Version: 1.0 To: Jim Stapleton References: <80f4f2b20708261357x170788f0u4e8a11877bdfa53b@mail.gmail.com> In-Reply-To: <80f4f2b20708261357x170788f0u4e8a11877bdfa53b@mail.gmail.com> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (smtp.infracaninophile.co.uk [IPv6:::1]); Sun, 26 Aug 2007 22:16:16 +0100 (BST) X-Virus-Scanned: ClamAV 0.91.1/4068/Sun Aug 26 20:19:02 2007 on happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on happy-idiot-talk.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org Subject: Re: /bin/[ X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Aug 2007 21:16:22 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Jim Stapleton wrote: > Sorry if you get this question a lot - a few searches didn't find > results for me. > > I have a "/bin/[" file in my system - I just want to make sure it's > not a sign of someone having hacked my machine. No -- that's perfectly alright. If you look closely you can see that it is in fact identical to /bin/test: % ls -lai test '[' 871508 -r-xr-xr-x 2 root wheel 7652 Aug 18 12:31 [* 871508 -r-xr-xr-x 2 root wheel 7652 Aug 18 12:31 test* It's used for testing various conditions in shell scripts -- like this for example: [ "x$foo" != "x" ] && echo "\$foo is set to $foo" which could be written equivalently as: test "x$foo" != "x" && echo 2\$foo is set to $foo" The curious name is historic, based on some early shells where there was a built-in syntax using the '[' character. Having test or [ as an external program means that all the standard shell on FreeBSD can use exactly the same test syntax and theres only one copy of the code to keep maintained in the source tree. Cheers, Matthew - -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG0e2e8Mjk52CukIwRCElMAJ40jLDH5y/TKKUJ7uT5Mv84LdnZgQCdG5Iy 4Y3I0l4+Hv9WMZTvl1jri64= =xzZw -----END PGP SIGNATURE-----