basename: 去掉路径和扩展名

  /bin/basename

  coreutils-8.4-9.el6.x86_64

  basename命令用于去掉路径信息,返回纯粹的文件名,如果指定的文件的扩展名,则将扩展名也一并去掉。 

[root@vClass-ftYDC systemupdate]# basename --help
用法:basename 名称 [后缀]
 或:basename 选项
去掉前导的目录部分后打印"名称"。
如果指定的话,还会去掉尾随的"后缀"。

      --help		显示此帮助信息并退出
      --version		显示版本信息并退出

示例:
  basename /usr/bin/sort       输出"sort"。
  basename include/stdio.h .h  输出"stdio"。

请向bug-coreutils@gnu.org 报告basename 的错误
GNU coreutils 项目主页:<http://www.gnu.org/software/coreutils/>
GNU 软件一般性帮助:<http://www.gnu.org/gethelp/>
请向<http://translationproject.org/team/zh_CN.html> 报告basename 的翻译错误
要获取完整文档,请运行:info coreutils 'basename invocation'

 

getopt & getopts

 getopt   util-linux-2.23.2-33.el7_3.2.x86_64

   getopts  bash-4.2.46-21.el7_3.x86_64

绝大多数脚本使用getopts应该就可以满足需求了,如果需要支持长选项以及可选参数,那么就需要使用getopt了.。

 

 

http://www.cnblogs.com/muahao/p/6252392.html

  

posted on 2017-02-28 17:15  doscho  阅读(857)  评论(0编辑  收藏  举报