A scripts/cmd [License: UNKNOWN] commit e43a92a2b4239dfe2cb82175146fa72fea79b382 Author: Gary Cramblitt Date: Sat Jun 19 16:08:49 2004 +0000 Script for any command. svn path=/trunk/kdeextragear-2/konversation/; revision=321981 diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 7ae6758..6c342bf 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,4 +1,4 @@ scriptsdir=$(kde_datadir)/konversation/scripts -scripts_SCRIPTS=amarok bug fortune gauge juk noatun uptime kdeversion +scripts_SCRIPTS=amarok bug fortune gauge juk noatun uptime kdeversion cmd scripts_DATA=fortunes.dat diff --git a/scripts/cmd b/scripts/cmd new file mode 100755 index 0000000..d67ce08 --- /dev/null +++ b/scripts/cmd @@ -0,0 +1,31 @@ +#!/usr/bin/perl -w + +# Script to display output from any command for Konversation +# Example: /exec cmd uname -a +# made by Gary Cramblitt +# The script might be uncompatible with other unix variants than linux. +# only tested on Debian GNU/Linux Sid +# use the code for whatever you wish :-) + + +$PORT = shift; +$SERVER = shift; +$TARGET = shift; +$CMDPART = shift; +$CMD = $CMDPART; +$CMDPART = shift; +while($CMDPART) + { + $CMD .= " " . $CMDPART; + $CMDPART = shift; + } +$CMDOUTPUT = `$CMD`; +if($CMDOUTPUT) + { + exec ("dcop $PORT Konversation say $SERVER \"$TARGET\" \"$CMD: $CMDOUTPUT\""); + } +else + { + exec ("dcop $PORT Konversation info \"Could not do $CMD.\""); + } +