This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Exec Shell command with multiline output

Help for those learning Tcl or writing their own scripts.
Post Reply
M
MUD
Voice
Posts: 1
Joined: Sat Aug 10, 2013 11:36 pm

Exec Shell command with multiline output

Post by MUD »

It's been way over 10 years since I've used tcl and eggdrops, but I was trying to get a shell command to execute and display the results that outputs more then one line in the bash but not in a channel, right now I only get the first line output and stops there. Can anyone help remind me of what I am doing =) TIA

Code: Select all

bind pub -|- !ftpwho do_ftpwho

proc do_ftpwho {nick uhost hand chan text} {
    set my_ftpwho [exec ftpwho]
        puthelp "PRIVMSG $chan :$ftpwho"}
}
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

if the output has multiple lines, then split it in multiple lines.

Code: Select all

bind pub -|- !ftpwho do_ftpwho

proc do_ftpwho {nick uhost hand chan text} {
	set my_ftpwho [exec ftpwho] 
	foreach line [split $my_ftpwho \n] {
		puthelp "PRIVMSG $chan :$line"
	}
}
Something like this should do what you wanted.
Once the game is over, the king and the pawn go back in the same box.
Post Reply