[ADMIN] Linux script to print Essentials motd.txt in color.

Discussion in 'Bukkit Tools' started by palisade, Apr 11, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    palisade

    This script can print out your Essentials motd.txt in ANSI color in your Linux shell. Change the path to your motd.txt in the motdfile variable at the top.

    Code:
    #!/bin/sh
    motdfile=$HOME/mc/plugins/Essentials/motd.txt
    tmpfile=/tmp/motd.tmp
     
    printf '\n\033[0m'
     
    cat $motdfile>$tmpfile
     
    sed -i 's:&4:\\\\033[0;31;40m:g' $tmpfile
    sed -i 's:&c:\\\\033[1;31;40m:g' $tmpfile
    sed -i 's:&6:\\\\033[0;33;40m:g' $tmpfile
    sed -i 's:&e:\\\\033[1;33;40m:g' $tmpfile
    sed -i 's:&2:\\\\033[0;32;40m:g' $tmpfile
    sed -i 's:&a:\\\\033[1;32;40m:g' $tmpfile
    sed -i 's:&b:\\\\033[1;36;40m:g' $tmpfile
    sed -i 's:&3:\\\\033[0;36;40m:g' $tmpfile
    sed -i 's:&1:\\\\033[0;34;40m:g' $tmpfile
    sed -i 's:&9:\\\\033[1;34;40m:g' $tmpfile
    sed -i 's:&d:\\\\033[1;35;40m:g' $tmpfile
    sed -i 's:&5:\\\\033[0;35;40m:g' $tmpfile
    sed -i 's:&f:\\\\033[1;37;40m:g' $tmpfile
    sed -i 's:&7:\\\\033[0;37;40m:g' $tmpfile
    sed -i 's:&8:\\\\033[1;30;40m:g' $tmpfile
    sed -i 's:&0:\\\\033[0;30;47m:g' $tmpfile
     
    while read line
    do
        echo "$line"
    done <$tmpfile
     
    rm -f $tmpfile
     
    printf '\n\033[0m'
     
Thread Status:
Not open for further replies.

Share This Page