diff options
author | Jérémy Compostella <jeremy.compostella@gmail.com> | 2012-03-04 20:00:36 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2012-03-07 12:59:00 +0000 |
commit | a3eb71a98fd195e52d335fb8d6bdc2a719cc2c88 (patch) | |
tree | 9e1d64ff718175b75422d71037adcb89cc86b9eb /doc | |
parent | 4b4a465798a212925670cc4fef7610678d221d69 (diff) | |
download | coreutils-a3eb71a98fd195e52d335fb8d6bdc2a719cc2c88.tar.xz |
basename: support more than one argument
* src/basename.c (perform_basename): New function refactored from
main() that performs the basename work on a STRING, optionally
removes a trailing SUFFIX and outputs the result.
(main): Handle new options.
* doc/coreutils.texi (basename invocation): Mention new options.
* test/misc/basename: Add new options test cases.
* NEWS (New features): Mention it.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/coreutils.texi | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 4a4cadbcb..967023e25 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -12422,6 +12422,7 @@ This section describes commands that manipulate file names. @example basename @var{name} [@var{suffix}] +basename @var{option}... @var{name}... @end example If @var{suffix} is specified and is identical to the end of @var{name}, @@ -12445,8 +12446,27 @@ for everything except file names containing a trailing newline. result is @samp{//} on platforms where @var{//} is distinct from @var{/}, and @samp{/} on platforms where there is no difference. -The only options are @option{--help} and @option{--version}. @xref{Common -options}. Options must precede operands. +The program accepts the following options. Also see @ref{Common options}. +Options must precede operands. + +@table @samp + +@item -a +@itemx --multiple +@opindex -a +@opindex --multiple +Support more than one argument. Treat every argument as a @var{name}. +With this, an optional @var{suffix} must be specified using the +@option{-s} option. + +@item -s @var{suffix} +@itemx --suffix=@var{suffix} +@opindex -s +@opindex --suffix +Remove a trailing @var{suffix}. +This option implies the @option{-a} option. + +@end table @exitstatus @@ -12458,6 +12478,12 @@ basename /usr/bin/sort # Output "stdio". basename include/stdio.h .h + +# Output "stdio". +basename -s .h include/stdio.h + +# Output "stdio" followed by "stdlib" +basename -a -s .h include/stdio.h include/stdlib.h @end smallexample |