From owner-freebsd-questions Mon Nov 13 8:34:45 2000 Delivered-To: freebsd-questions@freebsd.org Received: from smtpproxy1.mitre.org (mb-20-100.mitre.org [129.83.20.100]) by hub.freebsd.org (Postfix) with ESMTP id 5D1A637B479 for ; Mon, 13 Nov 2000 08:34:40 -0800 (PST) Received: from avsrv1.mitre.org (avsrv1.mitre.org [129.83.20.58]) by smtpproxy1.mitre.org (8.9.3/8.9.3) with ESMTP id LAA00126 for ; Mon, 13 Nov 2000 11:34:32 -0500 (EST) Received: from mailsrv2.mitre.org (mailsrv2.mitre.org [129.83.221.17]) by smtpsrv1.mitre.org (8.9.3/8.9.3) with ESMTP id LAA28026 for ; Mon, 13 Nov 2000 11:34:31 -0500 (EST) Received: from mitre.org ([128.29.145.140]) by mailsrv2.mitre.org (Netscape Messaging Server 4.15) with ESMTP id G3Z21I00.VTC; Mon, 13 Nov 2000 11:34:30 -0500 Message-ID: <3A101848.D9F7105E@mitre.org> Date: Mon, 13 Nov 2000 11:35:20 -0500 From: "Andresen,Jason R." Organization: The MITRE Corporation X-Mailer: Mozilla 4.75 [en]C-20000818M (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Tommy Forrest - KE4PYM Cc: "freebsd-questions@FreeBSD.ORG" Subject: Re: What is "["? References: <200011130004.SAA06022@mailbox.mcs.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Tommy Forrest - KE4PYM wrote: > > Rooting around (no pun intended) my 4.0 system today I happened upon > a file called "[" in /bin. Not knowing what this file was I deleted > it. > > Rule number one: Dont delete that in which you do not know. Rename > it. > > Lesson learned. Soon after my network died. I rebooted the system. > Lots of bad things (tm) happened. Nothing would start up. So I > logged in and did a man [ and found it was a test utility. Then I > did a locate test |more Found /bin/test. Copied test to [ and > rebooted. Everything is happy. > > What, exactly, is "[". Why is it on my system as "["? It's the test command, just like the manpage said. It's called "[" so people writing shell scripts can do something like if [ -e file ] do good stuff done instead of if test -e file do good stuff done It makes shell scripting a little more readable. BTW, don't copy test to "[" hard link it instead. Both files are the same, and when test is updated, you want "[" to be updated as well. Besides, right now you have a redundant copy of test sitting on your system eating disk space (in root). -- _ _ _ ___ ____ ___ ______________________________________ / \/ \ | ||_ _|| _ \|___| | Jason Andresen -- jandrese@mitre.org / /\/\ \ | | | | | |/ /|_|_ | Views expressed may not reflect those /_/ \_\|_| |_| |_|\_\|___| | of the Mitre Corporation. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message