作用:去掉文件的目录和后缀

1.去掉文件路径

 jenkins@work:~/ci/script$ basename /backup/jenkins/ci/script/Release.sh.bak
Release.sh.bak

2.去掉文件后缀

 jenkins@work:~/ci/script$ basename /backup/jenkins/ci/script/Release.sh.bak .bak
Release.sh
jenkins@work:~/ci/script$ ls
Release.sh Release.sh.bak
jenkins@work:~/ci/script$

3.考虑后缀数量

jenkins@work:~/ci/script$ basename /backup/jenkins/ci/script/Release.sh.bak.old .old
Release.sh.bak
jenkins@work:~/ci/script$ basename /backup/jenkins/ci/script/Release.sh.bak.old .old .bak
basename: extra operand `.bak'
Try `basename --help' for more information.

4.不正常的后缀

 jenkins@work:~/ci/script$ basename ab b
a

5.其他

$@—— 打印参数

$#—— 打印参数个数

$?—— 最后一个命令/函数的执行结果,0为成功,非0失败

$!—— 最后一个后台运行进程的PID

$$—— 最后一个后台运行进程的PPID

basename usage in linux的更多相关文章

  1. 5 commands to check memory usage on Linux

    Memory Usage On linux, there are commands for almost everything, because the gui might not be always ...

  2. SHELL:Find Memory Usage In Linux (统计每个程序内存使用情况)

    转载一个shell统计linux系统中每个程序的内存使用情况,因为内存结构非常复杂,不一定100%精确,此shell可以在Ghub上下载. [root@db231 ~]# ./memstat.sh P ...

  3. Find command usage in Linux with excellent examples--reference

    http://www.coolcoder.in/2014/02/find-command-usage-in-linux-with.html find searches the directory tr ...

  4. the usage of linux command "expect"

    #! /usr/bin/expect -f# this script is used to practise the command "expect" #when "li ...

  5. Linux监控工具介绍系列——smem

    smem工具介绍 smem是Linux系统上的一款可以生成多种内存耗用报告的命令行工具.与现有工具不一样的是smem可以报告实际使用的物理内存(PSS),这是一种更有意义的指标.可以衡量虚拟内存系统的 ...

  6. linux概念之内存分析

    linux内存总结 分析样本[root@-comecs ~]# free total used free shared buffers cached Mem: -/+ buffers/cache: S ...

  7. ti processor sdk linux am335x evm /bin/setup-uboot-env.sh hacking

    #!/bin/sh # # ti processor sdk linux am335x evm /bin/setup-uboot-env.sh hacking # 说明: # 本文主要对TI的sdk中 ...

  8. Monitoring and Tuning the Linux Networking Stack: Receiving Data

    http://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-networking-stack-receiving-data/ ...

  9. Linux 服务器系统监控脚本 Shell【转】

    转自: Linux 服务器系统监控脚本 Shell - 今日头条(www.toutiao.com)http://www.toutiao.com/i6373134402163048961/ 本程序在Ce ...

随机推荐

  1. COS访谈第十八期:陈天奇

    COS访谈第十八期:陈天奇 [COS编辑部按] 受访者:陈天奇      采访者:何通   编辑:王小宁 简介:陈天奇,华盛顿大学计算机系博士生,研究方向为大规模机器学习.他曾获得KDD CUP 20 ...

  2. WIN32程序挂钩SetLastError,输出错误描述到控制台

    WIN32程序挂钩SetLastError,输出错误描述到控制台 作者:徐灵甫 一.窗口模式应用程序(GUI)启用控制台的方法为: 步骤 方法 1 启动/关闭控制台 AllocConsole()Fre ...

  3. 理解使用static import 机制(转)

    J2SE 1.5里引入了“Static Import”机制,借助这一机制,可以用略掉所在的类或接口名的方式,来使用静态成员.本文介绍这一机制的使用方法,以及使用过程中的注意事项. 在Java程序中,是 ...

  4. 【转】no resource found @integer/google_play_services_version whats this?

    原文网址:http://stackoverflow.com/questions/24325333/no-resource-found-integer-google-play-services-vers ...

  5. .net Web.Config配置文件 转

    .net Web.Config配置文件 博客分类: .net   .net Web.Config配置文件 一.配置信息 <?xml version="1.0" encodin ...

  6. HDOJ(HDU) 2088 Box of Bricks(平均值)

    Problem Description Little Bob likes playing with his box of bricks. He puts the bricks one upon ano ...

  7. DOL版USB Loader的下载和运行

    下载 在Wii上面玩硬盘版游戏,自然少不了USB Loader,相关教程和下载资源在网上一搜就有. 我在官网(地址:http://gwht.wikidot.com/usb-loader)上找到了一个下 ...

  8. Python学习笔记2-flask-sqlalchemy 简单笔记

    flask-sqlalchemy 简单笔记 字数 阅读 评论 喜欢 flask-sqlalchemy SQLAlchemy已经成为了python世界里面orm的标准,flask是一个轻巧的web框架, ...

  9. eclipse快捷键总结

    一.自定义快捷键 Window->Preferences->General->keys,进入快捷键管理界面,可以修改默认功能的快捷键组合例:修改以下快捷键功能(快捷键组合尽量保持唯一 ...

  10. iOS--导航栏样式

    push返回按钮样式: UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBar ...