basename usage in linux
作用:去掉文件的目录和后缀
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的更多相关文章
- 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 ...
- SHELL:Find Memory Usage In Linux (统计每个程序内存使用情况)
转载一个shell统计linux系统中每个程序的内存使用情况,因为内存结构非常复杂,不一定100%精确,此shell可以在Ghub上下载. [root@db231 ~]# ./memstat.sh P ...
- 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 ...
- the usage of linux command "expect"
#! /usr/bin/expect -f# this script is used to practise the command "expect" #when "li ...
- Linux监控工具介绍系列——smem
smem工具介绍 smem是Linux系统上的一款可以生成多种内存耗用报告的命令行工具.与现有工具不一样的是smem可以报告实际使用的物理内存(PSS),这是一种更有意义的指标.可以衡量虚拟内存系统的 ...
- linux概念之内存分析
linux内存总结 分析样本[root@-comecs ~]# free total used free shared buffers cached Mem: -/+ buffers/cache: S ...
- 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中 ...
- Monitoring and Tuning the Linux Networking Stack: Receiving Data
http://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-networking-stack-receiving-data/ ...
- Linux 服务器系统监控脚本 Shell【转】
转自: Linux 服务器系统监控脚本 Shell - 今日头条(www.toutiao.com)http://www.toutiao.com/i6373134402163048961/ 本程序在Ce ...
随机推荐
- KEIL, a Smart Comliler
KEIL是一个神的编译器.举一二例来说明: 1. 编译器出现WARNING"expression with possibly no effect",是提示你当前语在正做无用功,如在 ...
- redis 基本使用
Redis是一种高级key-value数据库.它跟memcached类似,不过数据可以持久化,而且支持的数据类型很丰富.有字符串,链表,集 合和有序集合.支持在服务器端计算集合的并,交和补集(diff ...
- 两种解法-树形dp+二分+单调队列(或RMQ)-hdu-4123-Bob’s Race
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4123 题目大意: 给一棵树,n个节点,每条边有个权值,从每个点i出发有个不经过自己走过的点的最远距离 ...
- 【HDOJ】5063 Operation the Sequence
#include <cstdio> #include <cstring> #include <cstdlib> #define MAXN 100005 #defin ...
- POJ 1511 SPFA+邻接表 Invitation Cards
题目大意: 计算从 1 点 到 其他所有点的 往返距离之和, 因为是 有向图, 所以我们需要将图反存 一次, 然后求两次单源最短路, 结果就出来了. #include <iostream> ...
- rowspan和colspan
1.说明 rowspan:跨行colspan:跨列用于设计复杂的表格 2.例子<!DOCTYPE html> <html> <head> <meta char ...
- 未能找到类型或命名空间名称“XXXX”(是否缺少 using 指令或程序集引用?) 转
未能找到类型或命名空间名称“XXXX”(是否缺少 using 指令或程序集引用?) 项目中 App_Code 文件夹中的类的命名空间,在添加的页面的 using XXXX 时,提示 未能找到类 ...
- C++: Command Line Processing
Save this code here for studying and using it. Surce code is here. CmdLine.h File #pragma once #incl ...
- Java-单机版的书店管理系统(练习设计模块和思想_系列汇总)
介绍: 本软件系列到此,我已经全部写完了. 项目练习目标 : 1.Java应用程序基本分析 2.培养面向对象编程的基本思想 3.Java基本设计模式综合应用 4.掌握分层和接口的基本设计 5.构建合理 ...
- [Java Concurrent] 多线程合作 producer-consumers / queue 的简单案例
在多线程环境下,通过 BlockingQueue,实现生产者-消费者场景. Toast 被生产和消费的对象. ToastQueue 继承了 LinkedblockingQueue ,用于中间存储 To ...