bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug on basename


From: Pádraig Brady
Subject: Re: bug on basename
Date: Wed, 14 Jan 2009 13:56:31 +0000
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Leonardo wrote:
> basename does not check if the file exists.

That's expected behaviour.
Use the test command to check file existence:

input=Desktop/okidoki
file=$(test -e "$input" && basename "$input")
[ "$file" ] && echo "$file" || echo "missing"

Pádraig.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]