📄 readpipe.sh
字号:
#!/bin/sh# readpipe.sh# This example contributed by Bjon Eriksson.last="(null)"cat $0 |while read linedo echo "{$line}" last=$linedoneprintf "\nAll done, last:$last\n"exit 0 # End of code. # (Partial) output of script follows. # The 'echo' supplies extra brackets.#############################################./readpipe.sh {#!/bin/sh}{last="(null)"}{cat $0 |}{while read line}{do}{echo "{$line}"}{last=$line}{done}{printf "nAll done, last:$lastn"}All done, last:(null)The variable (last) is set within the subshell but unset outside.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -