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 ...
随机推荐
- Kafka分区分配策略-RangeAssignor、RoundRobinAssignor、StickyAssignor
引言按照Kafka默认的消费逻辑设定,一个分区只能被同一个消费组(ConsumerGroup)内的一个消费者消费.假设目前某消费组内只有一个消费者C0,订阅了一个topic,这个topic包含7个分区 ...
- select into 与 insert into select
1.select into select into 语句把一个表中的数据插入到另一个表中. 不需要创建临时表,在运行过程中自动创建. 基本语法: select * into #table_Name f ...
- Sqlserver MERGE 的基础用法
版权声明:本文为CSDN博主「暮雪寒寒」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明.原文链接:https://blog.csdn.net/qq_2762801 ...
- EF自动创建数据库步骤之二(继承DbContext类)
创建好表实体类后,接着就是创建数据库上下文(继承DbContext)并将实体类添加进来. 代码示例如下: using DBClientEntity; using System; using Syste ...
- current transaction is aborted, commands ignored until end of transaction block
current transaction is aborted, commands ignored until end of transaction block Error updating datab ...
- B端产品经理的金字塔能力模型
工作这几年,时长思考,作为B端产品经理自己应该具备什么样的能力? 虽然工作依旧在有条不紊的进行,但是时常会陷入到对知识或者能力的焦虑当中.特别时是工作三五年,产品经理进阶门槛时. 虽然产品经理的能力是 ...
- NioCopy文件
步骤: 1.创建输入输出流 fis fos 2.创建通道 fis.getchannel() fos.getchannel(); 3.创建缓存区 ByteBuffer buffer = ...
- Node.js官方文档:到底什么是阻塞(Blocking)与非阻塞(Non-Blocking)?
译者按: Node.js文档阅读系列之一. 原文: Overview of Blocking vs Non-Blocking 译者: Fundebug 为了保证可读性,本文采用意译而非直译. 这篇博客 ...
- 触发器TRIGGER 自增IDENTITY 聚集索引CLUSTERED
在触发器的“触发”过程中,有两个临时表inserted和deleted发生了作用.这两个特殊的临时表inserted和deleted,仅仅在触发器运行时存在,它们在某一特定时间和某一特定表相关. CR ...
- 使用Git Flow规范!
Git Flow常用的分支 Production 分支 也就是我们经常使用的Master分支,这个分支最近发布到生产环境的代码,最近发布的Release, 这个分支只能从其他分支合并,不能在这个分支直 ...