#!/bin/bash
# auth: xiluhua
# date: -- read -p "please input a username:" username
[ -z $username ] && echo "a username is needed" && exit if id $username &> /dev/null
then
echo $username 'is exist'
fi read -p "please input the passward:" passward
[ -z $passward ] && echo "a passward is needed" && exit useradd $username
echo "$passward" | passwd --stdin $username &> /dev/null
echo "add $username finished"

常用bash,autoUserAdd.sh的更多相关文章

  1. Linux常用 bash

    学会Linux常用 bash命令 目录 基本操作1.1. 文件操作1.2. 文本操作1.3. 目录操作1.4. SSH, 系统信息 & 网络操作 基本 Shell 编程2.1. 变量2.2.  ...

  2. Shell bash和sh区别

    Shell 中文意思贝壳,寓意类似内核的壳.Shell是指一种应用程序,这个应用程序提供了一个界面,用户通过这个界面访问操作系统内核的服务.Shell 是一个用 C 语言编写的程序,它是用户使用 Li ...

  3. linux 报错 bash ‘/bin/sh: Syntax error: “(” unexpected

    今天用make 编译 蹦到 bash ‘/bin/sh: Syntax error: “(” unexpected 和 /bin/sh: [[: not found 这种莫名奇妙的错误 原因是是lin ...

  4. 关于LINUX权限-bash: ./startup.sh: Permission denied

    关于LINUX权限-bash: ./startup.sh: Permission denied <script type="text/javascript"></ ...

  5. -bash: ./radar.sh: /bin/sh^M: bad interpreter: 没有那个文件或目录

    运行shell脚本时,报下面这个错误:   -bash: ./radar.sh: /bin/sh^M: bad interpreter: 没有那个文件或目录 错误分析: 因为操作系统是windows, ...

  6. -bash: ./test.sh: /bin/bash^M: bad interpreter: No such file or directory

    刚刚学习SHELL 写了一个简单的例子发生如下错误 -bash: ./test.sh: /bin/bash^M: bad interpreter: No such file or directory ...

  7. 【问题解决】syntax error: unexpected end of file或-bash: ./full_build.sh: /bin/bash^M: bad interpreter: No

    在阅读的过程中有不论什么问题,欢迎一起交流 邮箱:1494713801@qq.com    QQ:1494713801 运行一个脚本full_build.sh 时, 一直是提示我: -bash: ./ ...

  8. -bash: ./job.sh: /bin/sh^M: bad interpreter: 没有那个文件或目录

    昨天在windows下用写字板写了个shell脚本,使用winscp上传到linux上运行的时候发现运行不了,提示-bash: ./job.sh: /bin/sh^M: bad interpreter ...

  9. Shell脚本报错:-bash: ./switch.sh: /bin/bash^M: bad interpreter: No such file or directory

    在学习shell中测试case参数命令代码如下 #!/bin/bash #switch测试 case $1 in     start)         echo 'start'     ;;      ...

随机推荐

  1. 1-AO3402MOS管使用

    1.做电源设计,或者做驱动方面的电路,难免要用到MOS管.MOS管有很多种类,也有很多作用.做电源或者驱动的使用,当然就是用它的开关作用. 2.MOS管的三个极,G.S.D分别代表是什么? (1).判 ...

  2. 如何查看thinkphp版本号?

    我们有时不知道thinkphp版本号,怎么查看呢?很简单,tp5版本在/thinkphp/base.php文件中就可以查看define('THINK_VERSION', '5.0.15');如下图所示 ...

  3. Python识别字符型图片验证码

    前言 验证码是目前互联网上非常常见也是非常重要的一个事物,充当着很多系统的 防火墙 功能,但是随时OCR技术的发展,验证码暴露出来的安全问题也越来越严峻.本文介绍了一套字符验证码识别的完整流程,对于验 ...

  4. uWSGI+APScheduler不能执行定时任务

    在本地项目中使用APScheduler运行定时任务ok,但是在服务器上用uwsgi部署的Django环境下,APScheduler定时任务并不会被启动. 原因:uwsgi 默认one thread o ...

  5. List与Array互相转换

    List转换为Array可以这样处理: ArrayList<String> list=new ArrayList<String>(); String[] strings = n ...

  6. vux 使用swiper 垂直滚动文字 报错[Intervention] Ignored...

    [Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example becaus ...

  7. 【LeetCode每天一题】3Sum(三数之和)

    Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find ...

  8. [LeetCode] 840. Magic Squares In Grid_Easy

    A 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9 such that each row, co ...

  9. Junit + String/Integer/ArrayList/HashMap/TreeMap 基本使用Demo

    package JavaTest.test; import java.util.ArrayList; import java.util.HashMap; import java.util.List; ...

  10. Hybrid设计--离线更新

    首先server端和前端做一个增量发布系统 ,1.就是把一个增量包发布到一个版本的Native上去,让他做更新.2.后台对这个增量包的到达率或者成功的更新做一个统计.这是比较复杂的. 离线更新的机制: ...