2017-06-04 69 views
-1

嗨我正在爲一個學校作業編寫一個shell腳本,但似乎無法根據需要使其工作。貝婁是我迄今爲止所擁有的。我想要做的是添加帳戶名稱,例如用戶帳戶創建時的真實姓名。此外還有一個Cron選項卡,可在每天11:59記錄磁盤使用情況並將其保存到storage.log中。user_create.sh Ubuntu shell腳本

#!/bin/bash 

IFS="," 

while read f1 f2 f3 f4 

do hostname $f1 
    useradd $f2 
    passwd $f3 
    groupadd $f4 

     #echo "Real name  : $f1" 

     #echo "Username   : $f2" 

     #echo "Default password  : $f3" 

     #echo "Group Name  : $f4" 

59 11 * * * sudo du >>/home/bond/Desktop/GroupActivities/storage.log 
done < /home/bond/Desktop/GroupActivities/data.csv 
+0

什麼是你的問題? – syntagma

+0

如何分配帳戶名稱?例如喬恩doe jdoe –

回答

0

useradd命令有一個標誌,不正是你所需要的,從man useradd

-c, --comment COMMENT 
     Any text string. It is generally a short description of the login, and is currently used as the field for the user's full name. 
+0

嗨,我不明白這一點,它仍然無法正常工作。你可以編輯我提供的代碼 –