user_create.sh Ubuntu shell脚本

时间:2017-06-04 06:31:44

标签: bash shell ubuntu

您好我正在为学校作业编写一个shell脚本,但似乎无法根据需要使其工作。贝娄是我迄今为止所拥有的。我的目标是添加帐户名称,例如创建用户帐户时的真实姓名。还有一个Cron选项卡,它在每天11:59记录磁盘使用情况并将其保存到storage.log。

#!/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

1 个答案:

答案 0 :(得分:0)

public class ShowActivity extends AppCompatActivity { public static String[] descriptions; TextView tvDetail; String listitems[]; int intposition = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_show); descriptions = getResources().getStringArray(R.array.Description); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.list_content,descriptions); intposition = getIntent().getIntExtra("position", 0); tvDetail = (TextView) findViewById(R.id.tvDetail); tvDetail.setText((CharSequence) adapter); tvDetail.setMovementMethod(new ScrollingMovementMethod()); } } 命令有一个标记,可以完全满足您的需求,来自useradd

man useradd