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

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. 破解简单Mifare射频卡密钥杂记

    先要了解一点大学城浴卡用的是什么卡,经查证是Mifare S50卡,也有叫ISO14443A的(协议名).本来想看看大学城浴卡有没有安全漏洞,没想到浴卡公司在安全性上几乎是蔑视我们大学生的智商,虽然被 ...

  2. html动态编辑框

    简述: 随着在输入框中增加字符,动态矿高度增加(IE9及以上 chrome  firefox) 由于IE8 不支持oninput函数,所以不能实现此效果 事件函数: function feedDivO ...

  3. poi导出word

    最近做了个poi导出word的功能 下面是代码: 一个可以参考的例子: package com.lzb.crm.web; import java.io.FileOutputStream; import ...

  4. POJ1088 滑雪(记忆化搜索)

    题目链接. 分析: 状态转移方程 d[i][j] = max(d[i-1][j], d[i+1][j], d[i][j-1], d[i][j+1]). #include <iostream> ...

  5. Palindrome Partitioning——LeetCode

    Given a string s, partition s such that every substring of the partition is a palindrome. Return all ...

  6. HDOJ(HDU) 1718 Rank(水题、、、)

    Problem Description Jackson wants to know his rank in the class. The professor has posted a list of ...

  7. [工作] 使在家办公(Work From Home)更有效率的建议

    在家办公(Work From Home) 是一种灵活的工作方式,节省了漫长的上下班挤公交的时间,有更多可支配的时间. 我司允许员工申请在家办公,每周一天的配额.本人长期在办公室工作,习惯了办公室里工作 ...

  8. KVM几种缓存模式

    原文在这里: http://pic.dhe.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=%2Fliaat%2Fliaatbpkvmguestca ...

  9. maven项目 打可执行jar包

    1.pom添加 <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</art ...

  10. UVa 10617 Again Palindromes / 记忆化搜索

    删除若干个字母后 剩下的是回文串 求有多少个 记忆化搜索 dp[i][j]表示i j 之间有多少个 其实递推也可以的 long long #include <stdio.h> #inclu ...