GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — linux-command/command/dirname.md at master · javamickey/linux-command

Expand file tree

/

dirname.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
40 lines (26 loc) · 905 Bytes
/

dirname.md

Copy path

File metadata and controls

40 lines (26 loc) · 905 Bytes
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

dirname

去除文件名中的非目录部分

补充说明

dirname命令 去除文件名中的非目录部分,仅显示与目录有关的内容。dirname命令读取指定路径名保留最后一个/及其后面的字符,删除其他部分,并写结果到标准输出。如果最后一个<cite>/</cite>后无字符,dirname 命令使用倒数第二个/,并忽略其后的所有字符。dirname 和 basename 通常在 shell 内部命令替换使用,以指定一个与指定输入文件名略有差异的输出文件名。

语法

dirname(选项)(参数)

选项

--help:显示帮助;
--version:显示版本号。

实例

dirname //
结果为 /

dirname /a/b/
结果为:/a

dirname a
结果为 .

dirname a/b
结果为路径名 a
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.