我有一个用于磁盘使用的脚本文件,但出现以下错误:
$ DISKTOTAL=$(df -m |column -t |awk '{print $2}' |tail -n +2|awk '{Total=Total+$1} END{print Total}')
df: '/var/lib/ureadahead/debugfs/tracing': No such file or directory
$ DISKUSAGE=$(df -m |column -t |awk '{print $3}' |tail -n +2|awk '{Total=Total+$1} END{print Total}')
df: '/var/lib/ureadahead/debugfs/tracing': No such file or directory
$ DISKUSAGEPERCENT=$(echo "$DISKUSAGE / $DISKTOTAL * 100.0"|bc -l)
-bash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: Permission denied
执行脚本时也会出现此错误:
-bash: line 7: bc: command not found
为什么它不能识别bc
我的命令中的命令DISKUSAGEPERCENT
?
答案1
尝试安装bc
:
sudo apt install bc