ps aux | grep httpd | grep -v grep
#!/bin/sh
read -p 請(qǐng)輸入一段文字,將判斷所輸內(nèi)容是否為目錄: dir
if [ -d "$dir" ]
then
echo "輸入的是目錄"
else
echo "輸入的不是目錄"
fi
read -p 請(qǐng)輸入一段文字,將判斷所輸內(nèi)容是否為目錄: dir
if [ -d "$dir" ]
then
echo "輸入的是目錄"
else
echo "輸入的不是目錄"
fi
2015-08-06
[tes@bogon shellCode]$ vim if1.sh
#!/bin/sh
# 顯示分區(qū)信息 | 過濾行 | 過濾列,得到 xx% | 去掉 %
test=$(df -h | grep sda2 | awk '{print $5}' | cut -d "%" -f 1)
# 大于等于90
if [ "$test" -ge "10" ]
then
echo "當(dāng)前根分區(qū)使用率已超過90%,請(qǐng)及時(shí)處理??!"
fi
#!/bin/sh
# 顯示分區(qū)信息 | 過濾行 | 過濾列,得到 xx% | 去掉 %
test=$(df -h | grep sda2 | awk '{print $5}' | cut -d "%" -f 1)
# 大于等于90
if [ "$test" -ge "10" ]
then
echo "當(dāng)前根分區(qū)使用率已超過90%,請(qǐng)及時(shí)處理??!"
fi
2015-08-06
#!/bin/sh
test=$(env |grep "USER" |cut -d "=" -f2)
# if和[之間要有空格,[ 與"$test";"$test"與== 等之間也要有空格
if [ "$test" == root ]
then
echo "Current user is root"
fi
test=$(env |grep "USER" |cut -d "=" -f2)
# if和[之間要有空格,[ 與"$test";"$test"與== 等之間也要有空格
if [ "$test" == root ]
then
echo "Current user is root"
fi
2015-08-06
#!/bash/bash
test=$(env |grep "USER" |cut -d "=" 2)
if("$test == "root")
then
echo "current user is root!"
fi
test=$(env |grep "USER" |cut -d "=" 2)
if("$test == "root")
then
echo "current user is root!"
fi
2015-08-02