Hitachi

JP1 Version 11 JP1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide 


8.4.2 basename command (extracts a file name from a path)

Syntax

basename character-string[suffix]

Description

This command extracts a file name character string from a character string that conforms to the path naming conventions and then outputs it to the standard output.

If a suffix (a string of any characters) is specified, the command deletes the character string that matches the specified suffix from the end of the extracted character string.

The rules for extracting a file name character string are as follows:

Arguments

character-string

Specifies the character string from which a file name is to be extracted.

suffix

Specifies the suffix to be deleted from the end of the extracted file name. If the he following conditions are satisfied, the command outputs the extracted file name character string as is:

  • The suffix does not match the end of the file name character string.

  • The specified suffix is the same as the extracted file name character string.

Return code

Return code

Meaning

0

Normal termination

1

Termination with an error

Notes

This command has no options. Any option that is specified in the argument is treated as part of the character string or suffix that is to be subject to the extraction of a file name character string.

Examples