From owner-freebsd-newbies Wed Jun 20 22:44: 9 2001 Delivered-To: freebsd-newbies@freebsd.org Received: from whizkidtech.net (r42.bfm.org [216.127.220.138]) by hub.freebsd.org (Postfix) with ESMTP id BE8FF37B403 for ; Wed, 20 Jun 2001 22:44:03 -0700 (PDT) (envelope-from adam@whizkidtech.net) Received: (from adam@localhost) by whizkidtech.net (8.11.3/8.11.3) id f5L5hnk00327 for newbies@freebsd.org; Thu, 21 Jun 2001 00:43:49 -0500 (CDT) (envelope-from adam) Date: Thu, 21 Jun 2001 00:43:07 -0500 From: "G. Adam Stanislav" To: newbies@freebsd.org Subject: Darn DOS habits Message-ID: <20010621004307.A295@whizkidtech.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i Organization: Whiz Kid Technomagic X-Assembly-Language: http://int80h.org/ X-Web-Search: http://phonecowboy.master.com/ X-Operating-System: FreeBSD whizkidtech.net 4.3-20010525-STABLE FreeBSD 4.3-20010525-STABLE Sender: owner-freebsd-newbies@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org You might think that after tinkering with FreeBSD for some three years, I would not make certain stupid mistakes. Alas, old habits are hard to break. Especially when those habits come from using the DOS shell (I tossed COMMAND.COM for the Unix-like 4DOS many years ago), and when you are still using that shell under the other OS. Anyway, I did one of those stupid old-habits-die-hard mistakes today. I thought I'd share it with other newbies in the hope of stopping someone else from making the same mistake. I spent several hours (or at least it seemed that way) creating two EPS (Encapsulated PostScript) files containing some flowcharts. One was serv.eps, the other serv2.eps. I created them under the other OS because I wanted to see their output. (I created them by writing the PostScript code directly, not by using an image editor.) When done, I rebooted to FreeBSD, switched to the directory that was the final destination for these two files, and typed: cp /d/path/serv*.eps Now, what I *meant* to type was: cp /d/path/serv*.eps . That is, copy these two files to this directory. I forget that last dot a lot because under 4DOS the dot is implied: Its copy command always copies to the current directory unless you expressly tell it otherwise. Normally, I discover my mistake quite quickly as FreeBSD complains that I did not use the cp command correctly. This time, however, it did not complain. I realized my mistake anyway, and was wondering why it did not complain. When I figured the answer out, I was not happy. It was a mistake I should not have made because by now I know quite well that whenever we enter wildcards at the shell prompt, it is the shell that expands the wildcards. Indeed, the shell expanded /d/path/serv*.eps into: /d/path/serv.eps /d/path/serv2.eps In other words, when I entered cp /d/path/serv*.eps the shell changed it to: cp /d/path/serv.eps /d/path/serv2/eps That, unfortunately, is a perfectly legitimate way of using the cp command. It did not complain because what I really told it was to overwrite the contents of /d/path/serv2.eps with those of /d/path/serv.eps, and it did what I asked. And, of course, I had no backup (this was supposed to *be* the backup). Luckily, I had it still fresh in my mind, and was able to recreate serv2.eps in some 20 minutes or so (which, compared to hours, is not so bad). This has been a valuable lesson for me, and now I hope for at least some of you as well. Cheers, Adam -- A billion dollars in the bank, without the experience of carefreeness and charity, is a state of poverty. -- Deepak Chopra To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-newbies" in the body of the message