常用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' ;; ...
随机推荐
- 递归、嵌套for循环、map集合方式实现树形结构菜单列表查询
有时候, 我们需要用到菜单列表,但是怎么样去实现一个菜单列表的编写呢,这是一重要的问题. 比如我们需要编写一个树形结构的菜单,那么我们可以使用JQuery的zTree插件:http://www.tre ...
- CentOS+Uwsgi+Nginx发布Flask开发的WebAPI
1.WebAPI 开发工具VS 于Windows环境中开发完成后使用SFTP进行同步文件到Centos中使用 2.重点:WebAPI触发的方法是为了发送Celery异步调度任务 Celery框架使用涉 ...
- cxImage控件使用
属性: Picture:载入要显示的图片 Properties->Caption在没有内容的时候显示在图片框中间的文字 Properties->PopupMenuLayout->Me ...
- 每周工作4小时,蒂莫西·费里斯 最理想的工作方式和生活方式,QQ群666243547
内容简介 · · · · · · <每周工作4小时>是一本从观念到行为,彻底改变你的工作方式和生活方式的书.它既是数字时代的职场励志书和创业指导书,也是新新人类的全球化生存手册和人生哲学 ...
- Spark之数据倾斜 --采样分而治之解决方案
1 采样算法解决数据倾斜的思想 2 采样算法在spark数据倾斜中的具体操作
- 122A
Copy #include <stdio.h> int main() { int dig; int flag=0; scanf("%d", &dig); if( ...
- Java知识点ArrayList
ArrayList List<ApiSvcVersion> apiSvcVersionList = apiSvcVersionDao.getListByClientId(map1); // ...
- BiLSTM学习
转自:https://blog.csdn.net/aliceyangxi1987/article/details/77094970 https://blog.csdn.net/jojozhangju/ ...
- shell for 循环数组
name=(aa bb) ;i<${#name[*]};i++)) do name=${name[i]} echo "$name" done
- 21-Python3 模块
fibo.py文件 def fib(n): a,b = 0,1 while b<n: print(b,end='') a,b = b,a+b print() def fib2(n): resul ...