我是BASH的新手,所以請不要介意我的愚蠢問題,因爲我無法獲得任何好的資源來學習。簡單的Bash編程
我想創建一個腳本來顯示文件名及其大小。這是代碼是什麼樣子
filename=$1
if [ -f $filename ]; then
filesize=`du -b $1`
echo "The name of file is $1"
echo "Its size is $filesize"
else
echo "The file specified doesnot exists"
fi
輸出是這樣的
$ ./filesize.sh aa
The name of file is aa
Its size is 88 aa
但在最後一行我不想顯示文件名。我怎麼做 ? 我想用wc做同樣的事情。
這裏有一個很好的來源http://www.ibm.com/developerworks/library/l-bash.html – helpermethod 2010-06-16 10:13:44