Sorry about the prior reply, but after playing around with it for a little while.
I realized that you're idea is the correct way to do this.
I just had to add the last double quotation mark (") on a new line.
In a script it would look something like this:
Code:
#!/bin/bash
#
TIMEOUT=5
konsole --script &
SESSION=konsole-$!
TEST=`dcop $SESSION 2>&1 | grep "session-1"`
COUNT=0
while [ ! "$TEST" ];
do
if [ $COUNT == $TIMEOUT ];
then
echo "Timed Out."
exit 1
fi
TEST=`dcop $SESSION 2>&1 | grep "session-1"`
sleep 1
COUNT=$(($COUNT + 1))
done
dcop konsole-$! session-1 feedSession "PS1='\033[33;1m[\u \w]\$\033[0m '
"
The while loop ensures that the dcop interface is ready to communicate with before the script actually sends commands.
Thanks again Frankmulder