Shell
2018-08-31 19:07:48
5
0
0
#!/bin/bash
if [ $# -lt 1 ] ; then
echo "usage : $0 port"
exit -1
fi
find_pid_cmd="lsof -i:${1} -sTCP:LISTEN -F p"
pid=`${find_pid_cmd}`
if [ "${pid}" == "" ] ; then
echo "not found service o
# shell变量操作
## 字符串长度
`${#var}`
## 头部截取
把字符中头部符合`mode`的部分删除
懒惰模式:`${var#mode}`
贪婪模式:`${var##mode}`
```
var="abcabcabc"
echo ${var#*a}
bcabcabc
echo ${var##*a}
bc
```
## 尾部截取
把字符中尾部符合`mode`的部
# 关于linux shell中IFS变量的理解
## 介绍
Shell 脚本中有个变量叫 IFS(Internal Field Seprator) ,内部域分隔符。
完整定义是:The shell uses the value stored in IFS, which is the space, tab, and newline characters by default,
to delimi