常用bash,autoUserAdd.sh
#!/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的更多相关文章
- Linux常用 bash
学会Linux常用 bash命令 目录 基本操作1.1. 文件操作1.2. 文本操作1.3. 目录操作1.4. SSH, 系统信息 & 网络操作 基本 Shell 编程2.1. 变量2.2. ...
- Shell bash和sh区别
Shell 中文意思贝壳,寓意类似内核的壳.Shell是指一种应用程序,这个应用程序提供了一个界面,用户通过这个界面访问操作系统内核的服务.Shell 是一个用 C 语言编写的程序,它是用户使用 Li ...
- linux 报错 bash ‘/bin/sh: Syntax error: “(” unexpected
今天用make 编译 蹦到 bash ‘/bin/sh: Syntax error: “(” unexpected 和 /bin/sh: [[: not found 这种莫名奇妙的错误 原因是是lin ...
- 关于LINUX权限-bash: ./startup.sh: Permission denied
关于LINUX权限-bash: ./startup.sh: Permission denied <script type="text/javascript"></ ...
- -bash: ./radar.sh: /bin/sh^M: bad interpreter: 没有那个文件或目录
运行shell脚本时,报下面这个错误: -bash: ./radar.sh: /bin/sh^M: bad interpreter: 没有那个文件或目录 错误分析: 因为操作系统是windows, ...
- -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 ...
- 【问题解决】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: ./ ...
- -bash: ./job.sh: /bin/sh^M: bad interpreter: 没有那个文件或目录
昨天在windows下用写字板写了个shell脚本,使用winscp上传到linux上运行的时候发现运行不了,提示-bash: ./job.sh: /bin/sh^M: bad interpreter ...
- 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' ;; ...
随机推荐
- 一步步搭建 Spring Boot maven 框架的工程
摘要:让Spring应用从配置到运行更加快速,演示DIY Spring Boot 框架时,如何配置端口号,如何添加日志. Spring Boot 框架帮助开发者更容易地创建基于Spring的应用程序和 ...
- sql分页语句 速度比较快
select * from ( select *,ROW_NUMBER() over (order by createtime) as rank from taskInfo )
- 【雅思】【写作】【大作文】Advantage VS. Disadvantage
Advantage VS. Disadvantage Advantage vs. Disadvantage 社会现象或者做法 “People can work or study on the Inte ...
- DedeCMS后台500错误一种原因是不支持PHP5.3、5.4及以上版本
我们在迁移网站的时候,可能会出现DedeCMS后台500错误,有可能是因为dedecms不支持PHP5.3.5.4及以上版本,这时我们要改动一些设置才能修复成功.跟着ytkah来修改配置文件吧.首先打 ...
- what' the python之面向对象(进阶)
面向对象的知识点补充(进阶版) classmethod和staticmethod:这两个函数的用途就是可以不用实例化对象就可以调用方法 class Classmethod_Demo(): role = ...
- 在IIS6中FLV不能播放
故障:Flv文件在本地能播放,上传到服务器上不能播放. 原因:WIN2003加强了IIS6的MIME验证,一切未注册扩展文件格式统统显示404错误. 解决办法:在IIS服务器上添加对.FLV文件的支持 ...
- vue中$set的用法
数组: this.$set(Array,index, newValue) 对象: this.$set(Object, key, value)
- 多线程——newCachedThreadPool线程池
newCachedThreadPool线程池: 理解: 1).newCachedThreadPool可以创建一个无限大小的线程池(实际上是一个可缓存线程池). 可以通过Executors的静 ...
- ELKStack的基础入门和中文指南
一.ELKStack的中文指南 redhat系列配置repo源 rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch vi / ...
- Python的原型开发带来的关于Mock的思考
Python非常受欢迎,主要原因之一它包包多,能让你快速实现一个功能,并且很方便运行并看到效果,因此,它非常适合做原型开发. 什么是原型开发? 原型开发就是实现一个简单版本的开发. 在使用其他高级语言 ...