Chinaunix
标题:
"here document"/"here string" 原理
[打印本页]
作者:
yjh777
时间:
2016-01-27 10:38
标题:
"here document"/"here string" 原理
$ ls -l /proc/self/fd <<END
kkk
END
总用量 0
lr-x------ 1 yjh fs-qe 64 1月 27 10:37 0 -> /tmp/sh-thd-216099019213 (deleted)
lrwx------ 1 yjh fs-qe 64 1月 27 10:37 1 -> /dev/pts/29
lrwx------ 1 yjh fs-qe 64 1月 27 10:37 2 -> /dev/pts/29
lr-x------ 1 yjh fs-qe 64 1月 27 10:37 3 -> /proc/3296/fd
复制代码
$ ls -l /proc/self/fd <<<"kkk"
总用量 0
lr-x------ 1 yjh fs-qe 64 1月 27 10:38 0 -> /tmp/sh-thd-216098997507 (deleted)
lrwx------ 1 yjh fs-qe 64 1月 27 10:38 1 -> /dev/pts/29
lrwx------ 1 yjh fs-qe 64 1月 27 10:38 2 -> /dev/pts/29
lr-x------ 1 yjh fs-qe 64 1月 27 10:38 3 -> /proc/3322/fd
复制代码
over
作者:
ydzcjj
时间:
2016-01-27 11:03
学习了
刚开始接触用输出的比较多 输入的比较少 用cat来说明可能会更清楚一点
我想问第二个不是<<么 怎么有3个的?
作者:
yjh777
时间:
2016-01-27 15:27
ydzcjj 发表于 2016-01-27 11:03
学习了
刚开始接触用输出的比较多 输入的比较少 用cat来说明可能会更清楚一点
我想问第二个不是
三个是here string,两个是here document
用ls是查看重定向后 fd/0 到底从哪儿来,这里两种here *方法,都是用临时文件实现的
作者:
ydzcjj
时间:
2016-01-27 15:34
回复
3#
yjh777
谢谢解释,学习了!
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2