dirname and basename errors
From: Remi Villatel (maxilys_at_SPAMCOP.tele2.fr)
Date: 04/01/04
- Previous message: Michael Heiming: "Re: 20 basic Linux newbie commands to identify the system"
- Next in thread: Chris F.A. Johnson: "Re: dirname and basename errors"
- Reply: Chris F.A. Johnson: "Re: dirname and basename errors"
- Reply: mjt: "Re: dirname and basename errors"
- Reply: Lew Pitcher: "Re: dirname and basename errors"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 01 Apr 2004 02:10:00 +0200
Hi everybody,
I encountered a strange behavior of dirname and basename:
% dirname aaa/bbb/ccc/
aaa/bbb
% basename aaa/bbb/ccc/
ccc
Both are wrong answers! dirname should return "aaa/bbb/ccc/" unchanged and
basename shoud return an empty string IMHO.
How can I obtain correct answers from them with a pathname without a real
filename as in my example?
I introduced a test to check if the last char of the pathname is "/" but
isn't there anything more simple?
See ya,
==================
Remi Villatel
maxilys_@_tele2.fr
==================
- Previous message: Michael Heiming: "Re: 20 basic Linux newbie commands to identify the system"
- Next in thread: Chris F.A. Johnson: "Re: dirname and basename errors"
- Reply: Chris F.A. Johnson: "Re: dirname and basename errors"
- Reply: mjt: "Re: dirname and basename errors"
- Reply: Lew Pitcher: "Re: dirname and basename errors"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|