I've just seen the following ASCII art.
0000_____________0000________0000000000000000__000000000000000000+ 00000000_________00000000______000000000000000__0000000000000000000+ 000____000_______000____000_____000_______0000__00______0+ 000______000_____000______000_____________0000___00______0+ 0000______0000___0000______0000___________0000_____0_____0+ 0000______0000___0000______0000__________0000___________0+ 0000______0000___0000______0000_________000___0000000000+ 0000______0000___0000______0000________0000+ 000______000_____000______000________0000+ 000____000_______000____000_______00000+ 00000000_________00000000_______0000000+ 0000_____________0000________000000007I have a bash script that I would like to print this from. How can I do that?
This is something I might want to redistribute so to keep things simple, I'd prefer if answers didn't require additional things to be installed.
17 Answers
This is the shortest form I was able to produce, that prints exactly that 007 string:
base64 -d <<<"H4sIAJM2MVYAA1NQgAEDIIhHBsgCBmgAU8TAQJsL2SgU41AFiDALYRhUF8I0NAEUCbBZUB7MBGRrUXX
g8DC6CagORwkYtDCDcw3IMwDdOBL1IyRRwpBI7cihTlSYkRRNUHcRnUZgXIQGIlOoOQC/4ufk0gIAAA==" | gunzip 5 What about just echo?:
echo -e " 0000_____________0000________0000000000000000__000000000000000000+\n 00000000_________00000000______000000000000000__0000000000000000000+\n 000____000_______000____000_____000_______0000__00______0+\n 000______000_____000______000_____________0000___00______0+\n 0000______0000___0000______0000___________0000_____0_____0+\n 0000______0000___0000______0000__________0000___________0+\n 0000______0000___0000______0000_________000___0000000000+\n 0000______0000___0000______0000________0000+\n 000______000_____000______000________0000+\n 000____000_______000____000_______00000+\n 00000000_________00000000_______0000000+\n 0000_____________0000________000000007;"Every newline has been replaced with \n to shove it all into one line
It won't resize to the terminal though etc (unless you check the terminal width and echo one that is the right size), and it isn't that short either (is there a way to repeat characters better?) but it should work. If you want the colours as well you can use escape codes:
echo -e "\033[31m 0000\033[0m_____________0000________0000000000000000__000000000000000000+\n\033[31m 00000000\033[0m_________00000000______000000000000000__0000000000000000000+\n\033[31m 000\033[0m____000_______000____000_____000_______0000__00______0+\n\033[31m 000\033[0m______000_____000______000_____________0000___00______0+\n\033[31m 0000\033[0m______0000___0000______0000___________0000_____0_____0+\n\033[31m 0000\033[0m______0000___0000______0000__________0000___________0+\n\033[31m 0000\033[0m______0000___0000______0000_________000___0000000000+\n\033[31m 0000\033[0m______0000___0000______0000________0000+\n\033[31m 000\033[0m______000_____000______000________0000+\n\033[31m 000\033[0m____000_______000____000_______00000+\n\033[31m 00000000\033[0m_________00000000_______0000000+\n\033[31m 0000\033[0m_____________0000________000000007;"By the way you may want to consider copyright and boring stuff depending onhow you are using it - e.g. this version which is similar seems to still be in copyright.
2Put the characters in a file and cat it.
cat 007.txtUse a "here document"
cat <<EOF 0000_____________0000________0000000000000000__000000000000000000+ 00000000_________00000000______000000000000000__0000000000000000000+ . . .
EOFecho a string with embedded newlines
echo ' 0000_____________0000________0000000000000000__000000000000000000+ 00000000_________00000000______000000000000000__0000000000000000000+ . . .'The advantage of these approaches is that the art is still readable.
Shamefully borrowing ( aka stealing ) B.Roland's answer , I suggest a package with a colorfull name . . . toilet ! Which you can get with sudo apt-get install toilet and it works roughly like this:
xieerqi:$ toilet 007 mmmm mmmm mmmmmm m" "m m" "m #" # m # # m # m" # # # # m" #mm# #mm# m" It also supports changing fonts ( located in /usr/share/figlet )
toilet -f bigascii12 LINUX ## ###### ### ## ## ## ## ## ## ###### ### ## ## ## :## ##: ## ## ###: ## ## ## ## ## ## ## #### ## ## ## :####: ## ## ##:#: ## ## ## #### ## ## ## ## ## ## ## :##: ## ## ## ## ## ## ## :##: ## ## ## :#:## ## ## #### ## ## ## #### ## ## :####: ## ## ## :### ## ## ##::## ######## ###### ## ### :######: :## ##: ######## ###### ## ### :####: ## ## 11 Install banner package and create a bash script
sudo apt-get install sysvbannercheck below example of command
banner 007 1 Usage
cat << "EOF"
your_ascii_art
EOFSee the below example
cat << "EOF" 0000_____________0000________0000000000000000__000000000000000000+ 00000000_________00000000______000000000000000__0000000000000000000+ 000____000_______000____000_____000_______0000__00______0+ 000______000_____000______000_____________0000___00______0+ 0000______0000___0000______0000___________0000_____0_____0+ 0000______0000___0000______0000__________0000___________0+ 0000______0000___0000______0000_________000___0000000000+ 0000______0000___0000______0000________0000+ 000______000_____000______000________0000+ 000____000_______000____000_______00000+ 00000000_________00000000_______0000000+ 0000_____________0000________000000007
EOFGiven below some ascii art generator sites.
The simplest way of doing this would be to just put the art into a file and then echo it. That way it preserves the original representation in the file, so you can identify it easily!
echo ' 0000_____________0000________0000000000000000__000000000000000000+ 00000000_________00000000______000000000000000__0000000000000000000+ 000____000_______000____000_____000_______0000__00______0+ 000______000_____000______000_____________0000___00______0+ 0000______0000___0000______0000___________0000_____0_____0+ 0000______0000___0000______0000__________0000___________0+ 0000______0000___0000______0000_________000___0000000000+ 0000______0000___0000______0000________0000+ 000______000_____000______000________0000+ 000____000_______000____000_______00000+ 00000000_________00000000_______0000000+ 0000_____________0000________000000007' 1