]> git.saurik.com Git - apple/shell_cmds.git/blobdiff - basename/basename.1
shell_cmds-53.tar.gz
[apple/shell_cmds.git] / basename / basename.1
index d2cf5b7131878711acd94b70cb3b15e13b651a68..835d21a0cf14d274a0307fa8915c8594ed3615eb 100644 (file)
@@ -1,5 +1,3 @@
-.\"    $NetBSD: basename.1,v 1.11 1997/11/15 20:16:16 msaitoh Exp $
-.\"
 .\" Copyright (c) 1990, 1993, 1994
 .\"    The Regents of the University of California.  All rights reserved.
 .\"
 .\" Copyright (c) 1990, 1993, 1994
 .\"    The Regents of the University of California.  All rights reserved.
 .\"
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)basename.1 8.2 (Berkeley) 4/18/94
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)basename.1 8.2 (Berkeley) 4/18/94
+.\" $FreeBSD: src/usr.bin/basename/basename.1,v 1.13 2002/06/30 13:40:35 jmallett Exp $
 .\"
 .Dd April 18, 1994
 .Dt BASENAME 1
 .Os
 .Sh NAME
 .\"
 .Dd April 18, 1994
 .Dt BASENAME 1
 .Os
 .Sh NAME
-.Nm basename ,
-.Nm dirname
+.Nm basename , dirname
 .Nd return filename or directory portion of pathname
 .Sh SYNOPSIS
 .Nm
 .Ar string
 .Op Ar suffix
 .Nd return filename or directory portion of pathname
 .Sh SYNOPSIS
 .Nm
 .Ar string
 .Op Ar suffix
+.Nm
+.Op Fl a
+.Op Fl s Ar suffix
+.Ar string
+.Op Ar ...
 .Nm dirname
 .Ar string
 .Sh DESCRIPTION
 .Nm dirname
 .Ar string
 .Sh DESCRIPTION
+The
 .Nm
 .Nm
-deletes any prefix ending with the last slash
+utility deletes any prefix ending with the last slash
 .Ql \&/
 character present in
 .Ql \&/
 character present in
-.Ar string ,
+.Ar string
+(after first stripping trailing slashes),
 and a
 .Ar suffix ,
 if given.
 and a
 .Ar suffix ,
 if given.
+The
+.Ar suffix
+is not stripped if it is identical to the remaining characters in
+.Ar string .
 The resulting filename is written to the standard output.
 A non-existent suffix is ignored.
 The resulting filename is written to the standard output.
 A non-existent suffix is ignored.
+If
+.Fl a
+is specified, then every argument is treated as a
+.Ar string
+as if
+.Nm
+were invoked with just one argument.
+If
+.Fl s
+is specified, then the
+.Ar suffix
+is taken as its argument, and all other arguments are treated as a
+.Ar string .
 .Pp
 .Pp
+The
 .Nm dirname
 .Nm dirname
-deletes the filename portion, beginning
+utility deletes the filename portion, beginning
 with the last slash
 .Ql \&/
 character to the end of
 with the last slash
 .Ql \&/
 character to the end of
-.Ar string , 
+.Ar string
+(after first stripping trailing slashes),
 and writes the result to the standard output.
 and writes the result to the standard output.
-.Sh EXAMPLES 
+.Sh EXAMPLES
 The following line sets the shell variable
 .Ev FOO
 to
 .Pa /usr/bin .
 .Pp
 .Dl FOO=`dirname /usr/bin/trail`
 The following line sets the shell variable
 .Ev FOO
 to
 .Pa /usr/bin .
 .Pp
 .Dl FOO=`dirname /usr/bin/trail`
-.Sh DIAGNOSTICS
-Both the
-.Nm
-and
-.Nm dirname
-utilities
-exit 0 on success, and >0 if an error occurs.
+.Sh  DIAGNOSTICS
+.Ex -std basename dirname
 .Sh SEE ALSO
 .Xr csh 1 ,
 .Xr sh 1
 .Sh SEE ALSO
 .Xr csh 1 ,
 .Xr sh 1
@@ -90,5 +109,6 @@ The
 .Nm
 and
 .Nm dirname
 .Nm
 and
 .Nm dirname
-utilities conform to
-.St -p1003.2-92 .
+utilities are expected to be
+.St -p1003.2
+compatible.