“set -- $REPLY”是什么意思?

4
#!/bin/bash 
command1 |while read
do
set -- $REPLY
command2
done

我在浏览网络时发现了这段代码。'set -- $REPLY'是什么意思?

1个回答

2

它将 $REPLY 拆分成标记,并将它们放入 $@ (参数) 中。

$REPLYwhile read 表达式的隐含目标。但请注意,使用隐含目标的 while read 是一种 bash-ism,并且在例如 ash 中受支持(但在 zsh 中受支持)。最好使用 while read REPLY


那么$REPLY是做什么用的? - user24700

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接