小编Don*_*ame的帖子

"读取-p"在linux shell脚本中做了什么?

我有一个我复制和编辑过的脚本.如果可能的话,我需要解释几行.

这些是:

     read -p "please enter the username you wish to create: " username
     if id -u $username >/dev/null 2>&1; then
Run Code Online (Sandbox Code Playgroud)

怎么read -p办?怎么id -u办?怎么>/dev/null 2&1;办?然后在脚本中进一步说明这条线:

     sudo useradd -g $group -s $bash -d $homedir -m $username -p $password
Run Code Online (Sandbox Code Playgroud)

再次,请有人解释这一行中的所有减号吗?(-g,-s,-d,-m,-p)

linux shell

9
推荐指数
1
解决办法
2万
查看次数

标签 统计

linux ×1

shell ×1