用python建立一个临时
的
shell脚本
。里面放上你所需要所有调用。然后通过python的ossystem再调用这个临时的shell脚本。
如果还有
问题,就是你perl的问题。
记得要用chmod将shell脚本设置成可以执行。#!/bin/bash
function usage()
{
echo "USAGE: disk_usagesh [-a -n N] directory"
exit
}
function show()
{
dir=$1
if [[ $showall == "true" ]];then
ls -l --color=auto $dir
else
ls -l --color=auto $dir | grep -v total | head -n $shown
fi
}
showall=false
shown=10
while getopts 'an:' opt; do
case $opt in
a)
showall=true
;;
n)
shown=$OPTARG
;;
)
usage
;;
esac
done
shift $(($OPTIND - 1))
if [[ -z $1 ]] || [[ ! -d $1 ]];then
usage
fi
show $1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)