On 2010-08-28 20:54:42 +1000, Brian May wrote:
> When the solution is easy I don't see why we don't just do it.
> 
> br...@andean:~$ i="cat's meow.tar.gz"
> br...@andean:~$ echo "`basename "$i" .tar.gz`"
> cat's meow
> 
> (yes, the nested quotes don't seem to matter)

They matter if you have consecutive spaces, for instance.
And this is not sufficient:

xvii:~> i="--foo  bar.tar.gz"
xvii:~> echo "`basename "$i" .tar.gz`"
basename: invalid option -- '-'
Try `basename --help' for more information.

You need:

xvii:~> echo "`basename -- "$i" .tar.gz`"
--foo  bar

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


-- 
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100831082331.gb26...@prunille.vinc17.org

Reply via email to