【发布时间】:2012-10-21 16:53:15
【问题描述】:
#!/bin/bash
#OLDIFS=$IFS
IFS=$'\r'
fortune_lines=($(fortune | fold -w 90))
#Screen_Session=$"{mainscreen}"
Screen_Session=`screen -ls|grep "\."|grep "("|awk '{print $1}'`
Screen_OneLiner=$(screen -p 0 -S ${Screen_Session} -X stuff "`printf "${fortune_lines[@]}\r"`")
#IFS=$OLDIFS;
for var in "${Screen_OneLiner[@]}"
do
echo "${var}"
done
好的,这个脚本有效(排序)。我需要将字符串“say”放在整个数组索引的前面。目前我只能让它在第一行打印出“say”。
【问题讨论】:
-
是和否。是的,它是 osx 中“/usr/bin/say”中的内置命令。将文本变为说话。但我只需要使用 'say ' 作为字符串。 'say' 在我的用法中只是 java vm 中的命令。它是一个我的世界服务器,您需要在服务器的所有 cmets 前加上'say'
-
显示当前输出和所需输出(我的 Cygwin 会话中没有这些命令)。
-
我现在不在家,但基本上
-
我现在不在家,但基本上,输出看起来像
say line 0 of the array然后是all the rest of the array loops without say on the front所以我想说say on the front of each loop of the array
标签: arrays string bash loops append