编辑:这可能是一个错误(它没有打印任何错误并返回 0),我已将该问题通知 screen-devel gnu.org。
该脚本运行良好:
screen -S foo -dm
sleep 1 # workaround https://savannah.gnu.org/bugs/?54164
screen -S foo -X stuff '
echo 0;
echo 1;
echo 2;
echo 3;
echo 4;
echo 5;
echo 6;
echo 7;
echo 8;
echo 9;
echo 10;
echo 11;
echo 12;
echo 13;
echo 14;
echo 15;
echo 16;
echo 17;
echo 18;
echo 19;
echo 20;
echo 21;
echo 22;
echo 23;
echo 24;
echo 25;
echo 26;
echo 27;
echo 28;
echo 29;
echo 30;
echo 31;
echo 32;
echo 33;
echo 34;
echo 35;
echo 36;
echo 37;
echo 38;
echo 39;
echo 40;
echo 41;
echo 42;
echo 43;
echo 44;
echo 45;
echo 46;
echo 47;
echo 48;
echo 49;
echo 50;
echo 51;
echo 52;
echo 53;
echo 54;
echo 55;
echo 56;
echo 57;
echo 58;
echo 59;
echo 60;
echo 61;
echo 62;
echo 63;
echo 64;
echo 65;
echo 66;
echo 67;
echo 68;
echo 69;
echo 70;
echo 71;
echo 72;
echo 73;
echo 74;
echo 75;
echo 76;
echo 77;
echo 78;
echo 79;
echo 80;
echo 81;
echo 82;
echo 83;
echo 84;
'
#85+ is broken..
#84 works
echo $?
并echo $?
返回 0 表示成功。但是,如果我们添加echo 85;
到列表中,就像整个屏幕 -X 内容调用一样完全地忽略!foo 屏幕上实际上什么都没发生,也没有任何地方打印错误,仍然echo $?
打印 0 表示成功!发生了什么事?fwiw 我遇到问题的原始脚本要小得多,这个调用有效,直到你添加 10gb_8:
screen -S emergency_diskspace -dm
sleep 1 # workaround https://savannah.gnu.org/bugs/?54164
screen -S emergency_diskspace -X stuff '
mkdir /emergency_diskspace;
cd emergency_diskspace;
dd if=/dev/urandom of=10gb_0 bs=10M count=1000 iflag=fullblock status=progress;
dd if=/dev/urandom of=10gb_1 bs=10M count=1000 iflag=fullblock status=progress;
dd if=/dev/urandom of=10gb_2 bs=10M count=1000 iflag=fullblock status=progress;
dd if=/dev/urandom of=10gb_3 bs=10M count=1000 iflag=fullblock status=progress;
dd if=/dev/urandom of=10gb_4 bs=10M count=1000 iflag=fullblock status=progress;
dd if=/dev/urandom of=10gb_5 bs=10M count=1000 iflag=fullblock status=progress;
dd if=/dev/urandom of=10gb_6 bs=10M count=1000 iflag=fullblock status=progress;
dd if=/dev/urandom of=10gb_7 bs=10M count=1000 iflag=fullblock status=progress;
'
观察日期:
- Ubuntu 22.04 amd64
- 内核 5.15.0-40-通用
- GNU Screen 版本 4.09.00 (GNU) 2022 年 1 月 30 日
- GNU bash,版本 5.1.16(1)-发布(x86_64-pc-linux-gnu)