Wanted: How to strip off pathnames to obtain filenames.

Richard A. O'Keefe ok at quintus.uucp
Fri Sep 2 21:20:33 AEST 1988


In article <5968 at ihlpf.ATT.COM> pcl at ihlpf.ATT.COM (pcl) writes:
>My question is, given a full or partial pathname, how to obtain the
>last field (which is the filename) in a straight foward manner.

If you have the 'basename' command, that does what you want.
An example:
	$ FullName=/this/is/just/a/test
	$ basename $FullName
	test
	$ dirname $FullName
	/this/is/just/a



More information about the Comp.unix.questions mailing list