Sign in
Google apps
Main menu
Post a Comment On:
j4neiros
"basename and dirname in UNIXes"
No comments yet. -
1 – 0 of 0
I was reading
The Unix For Loop
today and I found that the following code will fail in the case of a filename like anoldfilename.old:
for i in *.old
do
j=`echo $i|sed 's/old/bak/'`
mv $i $j
done
I think the following will solve that problem:
j=`basename $i .old`
p=`dirname $i`
mv $i $p/$j.bak
The right tool for the right job!
posted by J. Ernesto Aneiros at
11:16 AM
on Jun 24, 2011
Leave your comment
You can use some HTML tags, such as
<b>, <i>, <a>
Choose an identity
Google Account
You will be asked to sign in after submitting your comment.
Name/URL
Comment with your Google account if you’d like to be able to manage your comments in the future. If you comment anonymously, you won’t be able to edit or delete your comment.
Learn more
Name
URL
Anonymous
Comment with your Google account if you’d like to be able to manage your comments in the future. If you comment anonymously, you won’t be able to edit or delete your comment.
Learn more
Please prove you're not a robot
"basename and dirname in UNIXes"
No comments yet. -