[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: quick shell questions

From: "Drew Cohan" <drewcohan@drewcohan.com>
Reply-To: <drew@drewcohan.com>
To: <debian-user@lists.debian.org>
Subject: quick shell questions
Date: Tue, 10 Dec 2002 13:00:51 -0500

1.  How do I combine these two (JPG vs jpg):

for f in /path/to/*.JPG; do mv "$f" `date +%N`.jpg; done
for f in /path/to/*.jpg; do mv "$f" `date +%N`.jpg; done
I gotta re read my shell book for this one. I'd recommend UNIX shells by Example by Ellie Quigley. It's a well written book.

I'm trying to avoid duplicate filenames during my renaming sessions.

2.  What does the "2>/dev/null>&1" mean that I see in a lot of examples
(eg ls 2>/dev/null/>&1).
I believe this is redirecting the standard error(2) to where the standard output(1) is going. Since standard ouput is redirected to /dev/null, the standard output will go there too. To make a long story short, they'll both end at /dev/null which is really nothing. You do this when you generate messages or return values that you don't need.

I really should take a shell scripting class.  :)


Drew Cohan

To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail

Reply to: