Newer
Older
invertedlogic / Scripts / ascii-art-banner.sh
@John Ryland John Ryland on 10 Jul 2009 2 KB cool script
#!/bin/bash

function get-line {
head -n $1 << EOF | tail -n 1
      
  _ \ 
\__,_\\
      
 |   
  _ \\
\___/
     
    
  _|
\__|
    
    |
  _ |
\___|
     
     
  __\\
\___/
     
  ,_)
_  _|
 _|  
     
     
  _ \\
\_  /
 ___)
 |   
  _ \\
_| _|
    
_|
 |
_|
  
 _|
  |
  /
_/ 
 |   
    /
_| _\\
     
 |
 |
_|
  
      
   \ \\
_|_|_|
      
     
  . \\
_| _|
     
     
  _ \\
\___/
     
     
  _ \\
  __/
_|   
     
  _ \\
\__ |
   _\\
    
  _\\
_|  
    
    
(_-<
___/
    
  | 
_ _|
 _| 
    
     
  | |
\___/
     
     
  / /
\__/ 
     
      
  ,  /
_/ _/ 
      
     
 \  /
_/ _\\
     
     
  | |
\_  /
___/ 
    
_  |
  / 
___|
    
    
    
    
    
    
EOF
}


function get-int-from-alpha {
    case $1 in
        "a")  echo 0 ;;
        "b")  echo 4 ;;
        "c")  echo 8 ;;
        "d")  echo 12 ;;
        "e")  echo 16 ;;
        "f")  echo 20 ;;
        "g")  echo 24 ;;
        "h")  echo 28 ;;
        "i")  echo 32 ;;
        "j")  echo 36 ;;
        "k")  echo 40 ;;
        "l")  echo 44 ;;
        "m")  echo 48 ;;
        "n")  echo 52 ;;
        "o")  echo 56 ;;
        "p")  echo 60 ;;
        "q")  echo 64 ;;
        "r")  echo 68 ;;
        "s")  echo 72 ;;
        "t")  echo 76 ;;
        "u")  echo 80 ;;
        "v")  echo 84 ;;
        "w")  echo 88 ;;
        "x")  echo 92 ;;
        "y")  echo 98 ;;
        "z")  echo 102 ;;
        "")   echo 104 ;;
    esac
}

function get-int-from-alpha-2 {
    if [ "$1" == "" ]
    then
        echo 27
    else
        LETTERS='a b c d e f g h i j k l m n o p q r s t u v w x y z'
        echo $LETTERS | tr ' ' '\n' | grep -i -n $1 | cut -d ':' -f 1
    fi
}

function print-letter {
    line=`get-int-from-alpha $1`
    get-line `expr $line + 1`
    get-line `expr $line + 2`
    get-line `expr $line + 3`
    get-line `expr $line + 4`
}


function print-string-horz {
   str=$1
   items="1 2 3 4"
   for l in $items
   do
     for (( i=0 ; i != ${#str} ; i=`expr $i + 1` ))
     do
         letterIndex=`get-int-from-alpha ${str:$i:1}`
         line=$(expr $letterIndex + $l)
         get-line $line | tr -d '\n'
     done
     echo
   done
}

print-string-horz "$@"


function print-string-vert {
     for (( i=0 ; i != ${#1} ; i=`expr $i + 1` ))
     do
            # echo "letter at $i is ${1:$i:1}"
            print-letter ${1:$i:1}
     done
}

# print-string-vert "$@"