shell 一些例子
#!/bin/bash
#Filename: password.sh by:-V love cmx stty -echo #这里表示 开启隐藏在终端的输出
read -p "Enter your password: " input #中间需要输入的任何信息都不会被打印出来,当
stty echo #关闭隐藏功能
echo
echo "Password read is $input"
这个时候只是交互的时候,用户输入的东西隐藏。但是 该显示的还是会显示,比如上个例子中的Enter your password!当然read 还自己带了一个选项来不回显这个输入的密码。
#!/bin/bash
# by -v love cmx start=`date +%s`
while read line
do echo $line
done < 2.txt end=`date +%s` difftime=$((end-start))
echo this running time is $difftime senconds
seq 1 100000 > 2.txt
10万个数字while 读取 一共8秒。多少毫秒还不知道咯,
shell 一些例子的更多相关文章
- Linux Shell 高级编程技巧4----几个常用的shell脚本例子
4.几个常用的shell脚本例子 4.0.在写脚本(同样适用在编程的时候),最好写好完善的注释 4.1.kill_processes.sh(一个杀死进程的脚本) #!/bin/bash c ...
- Shell数组例子
Shell数组例子 循环打印数组,并统计数组的个数: [root@slavedb array]# cat a.sh #!/bin/bash array=( freddy freddie tang sh ...
- org.apache.hadoop.util.Shell demo/例子
package cn.shell; import java.io.IOException; import org.apache.hadoop.util.Shell; public class Shel ...
- scala VS python2 操作shell对比例子
Scala: /** * Created by sunxu on 2015/9/30. */ import scala.sys.process._ import java.io.File //在相应目 ...
- Shell脚本例子集合
# vi xx.sh 退出并保存 # chmod +x xx.sh # ./xx.sh -2. 调试脚本的方法 # bash -x xx.sh 就可以调试了 . -1. 配置 secureCRT 的设 ...
- Linux Shell流程例子
#!/bin/bash read -p "input a dight:"echo $REPLY DATE=`date`echo "DATE is ${DATE}" ...
- shell --08 例子
目录 1.按照时间生成文件2018-05-22.log将每天的磁盘使用状态写入到对应日期的文件 [root@web01 ceshi]# cat 1.sh #!/bin/bash Date=`date ...
- shell脚本例子集锦(习题总结)
练习一:写一个脚本 .设定变量FILE的值为/etc/passwd .依次向/etc/passwd中的每个用户问好,并且说出对方的ID是什么 形如:(提示:LINE=`wc -l /etc/passw ...
- shell脚本例子
#!/bin/sh str="####" echo $1 | grep $str 1>/dev/null if [ `echo $?` -eq 0 ] then ec ...
随机推荐
- ipxe(可选):winboot:网络引导(启动)wim格式的windows PE系统:配置文件写法
ipxe 无盘[网络]引导wim格式的pe系统 wimboot引导程序需要为其提供4个内核参数 bcd bootmgr boot.sdi boot.wim 所需文件附件 以下是我的可用的ipxe的配置 ...
- 《STL源码剖析》——Vector
vector vector的源码分为多个文件:vector.<<stl_vector.h>> vector的底层实现是在<<stl_vector.h>> ...
- Vector线程安全,ArrayList非线程安全
http://baijiahao.baidu.com/s?id=1638844080997170869&wfr=spider&for=pc Vector线程安全,ArrayList非线 ...
- Python实现抽样分布的验证(正态分布、卡方分布、T分布)
参考链接:https://github.com/v-gazh/LearningStatsGroup/blob/master/week7/week7.ipynb 源地址:https://github.c ...
- Dubbo(一):dubbo-spring-boot-starter
dubbo-spring-boot-starter English Dubbo Spring Boot Starter.也可以关注dubbo官方的dubbo-spring-boot-project 支 ...
- 为python脚本增加命令行参数
from argparse import ArgumentParser p = ArgumentParser() p.add_argument('-b', '--body', help='Return ...
- 使用electron在mac升级签名后进行升级出现“QRLUpdaterErrorDomain”的错误
现在在开发electron客户端,windows签名使用了签名狗的方式进行签名(小坑:签名狗只能对打包完的exe进行签名,而electron-builder需要在打包的时候将证书配置进去,所以需要导出 ...
- 5.css三角的做法
如上图所示,类似这样的小三角都可以通过以下代码写出: .box1 { width: ; height: ; /* border: 10px solid pink; */ border-top: 10p ...
- uni-app 无痛刷新 token 方法
为了给用户一个流畅的体验, token 过期后需要重新请求新的 token 替换过期的 token 前端在请求接口时,和后端定义好了,如果状态码为 401 ,则表明 token 过期,需要前端请求新的 ...
- 人大金仓KCI
#include "bin/libkci.h" static void exit_nicely(KCIConnection *conn) { KCIConnectionDestor ...