0
我试图在我的bash脚本中调用du
时删除输出。我只是试图打印出当前目录的大小。所以它看起来像这样:从bash脚本中删除du输出的文件部分
DIRSIZE=$(du -hs $1)
printf "The size of the directory given is: %s\n" "$DIRSIZE"
我所要的输出是这样的:
The size of the directory given is: 32K
但是,我命令目前输出:
The size of the directory given is: 32K /home/dir_listed/
有一种简单的方法来消除目录?
pipe into'awk'NF - ' – 2015-02-24 08:38:33
或'du -hs“$ 1”| awk'{print“给出的目录大小为:”$ 1}“ – tripleee 2015-02-24 08:40:08