dirname and basename errors

From: Remi Villatel (maxilys_at_SPAMCOP.tele2.fr)
Date: 04/01/04

  • Next message: Chris F.A. Johnson: "Re: 20 basic Linux newbie commands to identify the system"
    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
    ==================


  • Next message: Chris F.A. Johnson: "Re: 20 basic Linux newbie commands to identify the system"