#!/bin/sh #myVar=`date`#case 1 #myVar=`cat /dev/stdin`#case 2 myVar=($(< /dev/stdin)) #case 3 echo $myVar exit 2
案例1工程案例2和3不起作用。 当我testing2或3; 没有输出,脚本也不会退出
我最终要求的是从后缀pipe道写入的stdin中读取数据
#!/bin/bash read fred echo $fred