架构大数据双料架构师

关注

shell while 读行

架构大数据双料架构师

关注

阅读 26

2022-06-11

shell while 读行

$ cat test 
1
22
33 3
  • ​​while-read.sh​​
#!/bin/bash
# while-read: read lines from a file
count=0
while read; do
printf "%d %s\n" $REPLY
count=$(expr $count + 1)
done <$1

执行:

$ bash  wile_read.sh test
1
22
33 3
count:3


相关推荐

芷兮离离

Shell for while 循环

芷兮离离 77 0 0

青乌

shell while until

青乌 77 0 0

琛彤麻麻

Shell while语句·

琛彤麻麻 131 0 0

进击的铁雾

shell 循环while语句

进击的铁雾 65 0 0

WikongGuan

Shell (四) 循环:while until

WikongGuan 59 0 0

JakietYu

shell基础--循环语句for/while

JakietYu 118 0 0

精进的医生

Shell脚本while循环小实验

精进的医生 55 0 0

金牛豆豆

LINUX SHELL使用while循环数组

金牛豆豆 81 0 0

花姐的职场人生

shell编程-for语法、while语法、break、continue

花姐的职场人生 72 0 0

拾光的Shelly

读mysql45讲-行锁

拾光的Shelly 81 0 0

精彩评论(0)

0 0 举报