那些年写过的shell------模式匹配
来源:互联网 发布:overcooked for mac 编辑:程序博客网 时间:2024/05/02 00:38
#! /bin/bash
####################################################
##Author: freeking
##Created: July 28th 2013
##Description match the pattern as the parameters
####################################################
varname="root/home/free/Program/ShellProgram"
#match the first '/' from the beginning and return the rest
echo ${varname#*/}
#match the last '/' from the beginning and return the rest
echo ${varname##*/}
#match the first '/' from the end and return the rest
echo ${varname%/*}
#match the last '/' from the end and return the rest
echo ${varname%%/*}
echo ${PATH}
#replace the first ':' with '\n'
echo -e ${PATH/:/'\n'}
#replace the all ':' with '\n'
echo -e ${PATH//:/'\n'
####################################################
##Author: freeking
##Created: July 28th 2013
##Description match the pattern as the parameters
####################################################
varname="root/home/free/Program/ShellProgram"
#match the first '/' from the beginning and return the rest
echo ${varname#*/}
#match the last '/' from the beginning and return the rest
echo ${varname##*/}
#match the first '/' from the end and return the rest
echo ${varname%/*}
#match the last '/' from the end and return the rest
echo ${varname%%/*}
echo ${PATH}
#replace the first ':' with '\n'
echo -e ${PATH/:/'\n'}
#replace the all ':' with '\n'
echo -e ${PATH//:/'\n'
- 那些年写过的shell------模式匹配
- 那些年写过的shell----select的使用
- 那些年写过的shell-----内置变量
- 那些年写过的shell-----判断用户变量
- 那些年写过的shell-----The useage of until
- 那些年写过的shell---The useage of while
- 那些年写过的shell---the function of debug
- 那些年写过的shell---- build in command
- 那些年写过的shell-----getopts实现菜单效果
- 那些年,我们一起写过的“单例模式”
- 那些年,我们一起写过的“单例模式”
- 那些年,我们一起写过的“单例模式”
- 那些年写过的shell-----------查找当前目录及子目录下>60K的目录
- 那些年写过的shell-----enable the color of echo
- 那些年,写过的代码
- 那些年写过的C语言
- 那些年我写过的代码
- 那些年写过的贪吃蛇
- SharePoint问题清单
- 高级PHP应用程序漏洞审核技术
- Andorid sun-java5-jdk 和 sun-java6-jdk的安装
- Extjs的gridPanel中列点击图片调用方法
- 驱动编程准备 配置内核树
- 那些年写过的shell------模式匹配
- RAII:互斥量
- java开发中经常遇到的问题
- Cortex-A相对经典ARM处理器的扩展
- VC 6.0工程向VS 2010转换的问题
- OCP-1Z0-053-V12.02-335题
- 学习软件开发应该看的书
- LeetCode题解:Reverse integer
- 大学c语言程序