Uploading bash output within IRSSI

I’m hardly an IRSSI power-user, but I occasionally make use of its more advanced features. While IRSSI already allows shell execution, it’s handy to have an alias that prints both the command and results to the channel (particularly when you’re running IRSSI on a server). I had previously picked up such an alias from Whales in #rgrd:

/alias do say `$*`; exec -o - $*

(Make sure to save it!)

However, this approach has drawbacks: I convinced Whales to run yes WEED (try it yourself if you don’t know what this does), which got him disconnected for flooding. Since I occasionally do want to run commands that produce a lot of output, I wrote a bash script intended to be executed from IRSSI. Here’s what it does:

/do upload "ls -R ~ | wc -l"

<Eronarn> `upload "ls -R ~ | wc -l"`
<Eronarn> http://eronarn.info/misc/uploads/12/05/19/1337402656.txt

Of course, it’s not really an upload – it’s just piping output into a file on the same server. (Then again, that means it’s that much faster to execute.)

As usual, my code is on Github. However, I’ll leave it here too to pad out my word count:

M=$(date +%m)
D=$(date +%d)
Y=$(date +%y)
T=$(date +%s)
cd $DIR
if [ ! -d "$Y" ]; then
 mkdir $Y
cd $Y
if [ ! -d "$M" ]; then
 mkdir $M
cd $M
if [ ! -d "$D" ]; then
 mkdir $D
cd $D
echo -e "$OUTPUT" > $FILE
echo $URL/$Y/$M/$D/$FILE

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>