您好我正在嘗試編寫一個名稱作爲參數的bourne-shell腳本,並檢查用戶是否已登錄並輸出消息。誰在bourne-shell中返回值
這是我到目前爲止,但我的情況是錯誤的。
if test "who|grep $1" == "$1" //the problem is that it takes the hole 1st column
then
who|grep $1|awk '{print $5}'
else
echo user not logged in
fi
有幫助嗎?提前致謝。
我算了4個錯誤。 – 2012-03-02 01:21:57
@ IgnacioVazquez-Abrams:這是否包括競賽條件? – Johnsyweb 2012-03-02 05:46:55