[root@moby bin]$ cat bipcons.sh
for A in $SESSIONS; do
NEWSESSION=`dcop $KONSOLE konsole newSession $A`
dcop $KONSOLE $NEWSESSION renameSession $A
# your command here on the next line!
dcop $KONSOLE $NEWSESSION sendSession "console $A"
dcop $CURSESSION closeSession
The above shell script I have saved to a icon on my kde desktop. The icon properties run this in the command section:
/usr/local/bin/konsole --script -e ~/bin/bipcons.sh
Basically it opens a new tab for each entry in $SESSIONS, assigns the tab name to that entry ($A) and then runs a command on that entry as well. In this example, the remote console app (http://www.conserver.com). Of course that app could be anything, like ssh.
Very useful stuff. Took me a long time to dig up this information on the web, so I'm posting it here for posterity.