Showing posts with label shell script. Show all posts
Showing posts with label shell script. Show all posts

Thursday, 16 March 2017

RAINBOW ROSE in shell script

To gift your friend, you can send him/her a rainbow rose by using below shell script

#!/bin/bash
RED='\033[1;31m'
GREEN='\033[1;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'

printf "${RED}    .--.---.\n"
sleep 1;
printf "   ( ${CYAN}\'--'/${RED} )\n"
sleep 1;
printf "  ( ${CYAN}'..-...'${RED} )\n"
sleep 1;
printf "   '.${CYAN}'-._.'${RED}.'\n"
sleep 1;
printf "    <'${CYAN}-.,.${RED}->\n"
sleep 1;
printf "${GREEN}       \`\\(  ${YELLOW}  _\n"
sleep 1;
printf "${GREEN}        < \ ${YELLOW} / \ \n"
sleep 1;
printf "       ${YELLOW}__${GREEN} \\\\\\ $YELLOW|_/\n"
sleep 1;
printf "      /  \ ${GREEN}\\\\\\ \n"
sleep 1;
printf "      ${YELLOW}'--'.${GREEN}\\\\\\ ${YELLOW}>\n"
sleep 1;
printf "${GREEN}            \\\\\\   \n"
printf "\n"
printf "${CYAN}RAI${RED}NBOW${GREEN} ${RED}ROSE${RED} FOR ${CYAN}YOU${CYAN} ${GREEN}MY${YELLOW} FRIEND\n"

And it will look like this:


Monday, 14 December 2015

Creating a Restaurant Menu using Shell script

I love to visit restaurant and on their counter you will see a machine, having list of all the items with their price tags. With the help of that machine, they generate your bills. You can create a same using the shell script.

Here is the code:

#!/bin/bash
out=$(dialog --stdout --menu 'CodingTheRightWay Menu' 999 999 999 Chocolate \$5 IceCream \$10)
echo "You ordered chocolate $out"

Save the code, and make it executable.

Once you run the code, then it will look like this:



You can use your keyboard arrows to choose the item, and for placing order. Cool!

Now, it's your time to create something interesting out of it.

Cheers,