Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

dirname(1) OSS Shell and Utilities Reference Manual
NAME
dirname - Returns specied parts of pathnames
SYNOPSIS
dirname string
DESCRIPTION
The dirname command reads the string specied on the command line, deletes from the last
/ (slash) to the end of the line, and writes the remaining pathname to standard output.
The dirname command is generally used inside command substitutions within a shell procedure
to specify an output lename that is some variation of a specied input lename.
EXAMPLES
1. To construct the name of a le located in the same directory as another, enter:
AOUTFILE=dirname $TEXTFILE/a.out
This command sets the AOUTFILE shell variable to the name of an a.out le in the
same directory as TEXTFILE.IfTEXTFILE is /u/fran/prog.c, then the value of dir-
name $TEXTFILE is /u/fran, and AOUTFILE becomes /u/fran/a.out.
RELATED INFORMATION
Commands: basename(1), sh(1).
316 Hewlett-Packard Company 527188-004