mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-11 16:01:28 +00:00
Merge pull request #1078 from ruth-hale/patch-6
Refactor dir_avail function
This commit is contained in:
@@ -9,10 +9,12 @@ echo "** 欢迎使用 **"
|
|||||||
echo "** ShellCrash **"
|
echo "** ShellCrash **"
|
||||||
echo "** by Juewuy **"
|
echo "** by Juewuy **"
|
||||||
echo "***********************************************"
|
echo "***********************************************"
|
||||||
#内置工具
|
|
||||||
|
# Check available capacity
|
||||||
dir_avail() {
|
dir_avail() {
|
||||||
df $2 $1 | awk '{ for(i=1;i<=NF;i++){ if(NR==1){ arr[i]=$i; }else{ arr[i]=arr[i]" "$i; } } } END{ for(i=1;i<=NF;i++){ print arr[i]; } }' | grep -E 'Ava|可用' | awk '{print $2}'
|
df -P $2 "${1:-.}" 2>/dev/null | awk 'NR==2 {print $(NF-2)}'
|
||||||
}
|
}
|
||||||
|
|
||||||
ckcmd() { #检查命令
|
ckcmd() { #检查命令
|
||||||
if command -v sh >/dev/null 2>&1;then
|
if command -v sh >/dev/null 2>&1;then
|
||||||
command -v "$1" >/dev/null 2>&1
|
command -v "$1" >/dev/null 2>&1
|
||||||
|
|||||||
Reference in New Issue
Block a user