[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
basename for directories containing space
From: |
Corrin Lakeland |
Subject: |
basename for directories containing space |
Date: |
Fri, 8 Sep 2006 08:30:16 +1200 |
address@hidden NZ PostSep06]$ echo `pwd`
/home/corrin/NZ PostSep06
address@hidden NZ PostSep06]$ basename `pwd`
NZ
address@hidden NZ PostSep06]$ basename --version
basename (GNU coreutils) 5.2.1
Written by FIXME unknown.
Surely the correct output is "NZ PostSep06"?
I can get the output I want using:
echo `pwd` | rev | cut -d / -f 1 | rev
But since this is exactly what basename is for... Plus my version doesn't
handle directory names with slashes in them, if such a directory is ever legal
(on windows?)
--
Corrin Lakeland
Datamine Limited
Phone: +64 4 384 4153
Mobile: +64 27 467 784
Fax: +64 4 384 1153
www.datamine.com
Visit us at: Level 1, 103 Ghuznee Street, Te Aro, Wellington, New Zealand
Pop it in the post: PO Box 11452, Manners Street, Wellington 6142, New Zealand
Disclaimer: This email and any files transmitted with it are confidential and
may contain legally privileged material, intended solely for the use of the
individual or entity to whom they are addressed. If you have received this
e-mail message in error, please contact the sender and delete the material from
any computer. Any use, review, dissemination, distribution or copying of this
document by persons other than the intended recipient is strictly prohibited.
Thank you
- basename for directories containing space,
Corrin Lakeland <=