#!/bin/bash
#
#**********************************************
#Author:    lanfeng
#QQ:        447320311
#Date:        2020-07-12
#FileName:    createuser.sh
#Version:    1.1
#Description:    The test script
#Copyright (C)    2020All rights reserved
#*********************************************
if grep "dabao" /etc/passwd    ;then
    echo "此用户已存在"
else
    useradd dabao
    grep "dabao" /etc/passwd
fi

此处以dabao未用户名进行判断,如果打包存在则提示"此用户已存在",否则创建此用户,并将创建用户的相关id,所属组等信息打印出来.

相关文章:

  • 2022-12-23
  • 2021-09-14
  • 2021-08-09
  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2021-07-19
  • 2021-05-18
  • 2022-12-23
相关资源
相似解决方案