1.\" Copyright (c) 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)basename.1 6.3 (Berkeley) 06/11/90 7.\" 8.Dt BASENAME 1 9.Dd 10.Os BSD 4.4 11.Sh NAME 12.Nm basename 13.Nd Extract filename from pathname 14.Sh SYNOPSIS 15.Nm basename 16.Ar string 17.Op suffix 18.Sh DESCRIPTION 19.Nm Basename 20strips 21.Ar string 22of its pathname prefix 23and a 24.Ar suffix , 25if given, to the standard output. 26If 27.Ar string 28ends in the slash character, 29.Li / , 30or is the same as the 31.Ar suffix 32argument, 33a newline is output. 34A non-existant suffix is ignored. 35.Pp 36The following line sets the shell variable 37.Ev FOO 38to 39.Pa /usr/bin . 40.Pp 41.Dl FOO=`dirname /usr/bin/trail` 42.Pp 43.Ar baseline 44utility exits 0 on success, and >0 if an error occurs. 45.Sh SEE ALSO 46.Xr sh 1 47.Sh STANDARDS 48The 49.Nm baseline 50function is expected to be POSIX 1003.2 compatible. 51