#!/bin/bash
IFS=$'\n'
fortune_lines=($(fortune | fold -w 30))
Screen_Session=$"{mainscreen}"
Screen_OneLiner=$(screen -p 0 -S ${Screen_Session} -X stuff "`printf "say ${fortune_lines[@]}\r"`")
for var in "${Screen_OneLiner[@]}"
do
echo -e "${var}"
done
The above script only prints out line 1 one of
IFS=$'\n'
fortune_lines=($(fortune | fold -w 30))
Instead of cycling through the whole index of “fortune_lines” Not sure how to make this work.
Any ideas?
FYI
I am only using
echo -e
to troubleshoot this script.
works fine for me I changed IFS to \r and it pumped out /etc/passwd where as with \n it only printed 1st line