181680c4c9
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@273 a672b425-5310-4d7a-af5c-997e18724b81
42 lines
1,021 B
HTML
42 lines
1,021 B
HTML
---
|
|
layout: page
|
|
category-page: intermediate
|
|
category-title: Intermediate commands
|
|
tags: basename suffix prefix name
|
|
author: Fabiano Fenini
|
|
title: basename
|
|
previous-page: pages/cmd/interm/base64.html
|
|
next-page: pages/cmd/interm/bash.html
|
|
---
|
|
The <code>basename</code> command deletes any prefix ending with the last slash "/" character
|
|
present in string and also a suffix.
|
|
|
|
<h3>Usage</h3>
|
|
The default basename command syntax is:
|
|
|
|
<pre>
|
|
basename [flags] [string] [suffix]
|
|
</pre>
|
|
|
|
Where [flags] are the cat flags, read below for more info, the string command is
|
|
the pathname and the suffix, if indicated, will be also deleted.
|
|
|
|
<h3>Flags</h3>
|
|
|
|
Here are some of the most common basename flags:
|
|
|
|
<ul>
|
|
<li><b>-a</b>: Every aregument is treated as a string </li>
|
|
<li><b>-s</b>: The suffix is taken as its argument </li>
|
|
<li><b>-a</b>: Supports multiple arguments and they will be treated as a name </li>
|
|
</ul>
|
|
|
|
<h3>Example<h3>
|
|
|
|
<pre>
|
|
basename /USI/command
|
|
</pre>
|
|
|
|
The shell will output this:
|
|
|
|
<pre>command</pre>
|