Fedora Linux Support Community & Resources Center
  #1  
Old 20th July 2012, 02:08 PM
steveking Offline
Registered User
 
Join Date: Apr 2012
Location: Surrey
Posts: 52
linuxubuntufirefox
Fun bash script I made

Ok so I got a little bored and desided to make a fun little bash script that you can use to scare Linux neewbies

Here is the code:

Quote:
#!/bin/bash
clear
echo "Formating disk(s): " /dev/sd*
sleep 2
echo "Initialising..."
sleep 2
echo "Are you sure you want to format these disks?"
# Declare variable choice and assign value 3
choice=3
# Print to stdout
echo "1. Yes"
echo "2. No"
echo -n "Please choose Yes or No? "
# Loop while the variable choice is equal 3
# bash while loop
while [ $choice -eq 3 ]; do

# read user input
read choice
#bash nested if/else
if [ "$choice" == "1" ] ; then
echo "Yes"
sleep 1
echo "Ok, formating starts in 5 seconds"
sleep 1
echo "4 seconds"
sleep 1
echo "3 seconds"
sleep 1
echo "2 seconds"
sleep 1
echo "1 seconds"
sleep 1

for i in {1..50000}
do
echo -n -e "\033[1m${color}0\033[0m"
done
sleep 1
echo ""
echo /dev/sd* "are formatted."

else

if [ "$choice" == "2" ] ; then
sleep 1
echo "Yes"
sleep 1
echo "Ok, formating starts in 5 seconds"
sleep 1
echo "4 seconds"
sleep 1
echo "3 seconds"
sleep 1
echo "2 seconds"
sleep 1
echo "1 seconds"
sleep 1

for i in {1..50000}
do
echo -n -e "\033[1m${color}0\033[0m"
done
sleep 1
echo ""
echo /dev/sd* "are formatted."

else

echo "Please choose Y or N? "
echo "1. Y"
echo "2. N"
echo -n "Please choose Y or N? "
choice=3

fi
fi
echo "All disk(s) now formatted rebooting in 5 seconds..."
sleep 1
echo "4"
sleep 1
echo "3"
sleep 1
echo "2"
sleep 1
echo "1"
sleep 1
echo "..................................."
sleep 1
echo "Shutting down now"
done

paste it into any old text editor save as "fun.sh" right click go to properties make executable and then in terminal type "./fun.sh"

Have fun scaring people!!
Reply With Quote
Reply

Tags
bash, fun, scripting

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with bash script woodson2 Programming & Packaging 5 25th December 2010 02:09 PM
Help with Bash script nat0925 Using Fedora 2 29th October 2010 05:23 AM
Check out this neat backup script I made for everyone! ACiD GRiM Guides & Solutions (No Questions) 3 1st February 2009 07:14 PM
bash script munna_dude Servers & Networking 12 30th July 2007 06:53 AM
Convert bash script to perl script homey Programming & Packaging 1 2nd September 2006 04:24 AM


Current GMT-time: 13:43 (Thursday, 30-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Kommunar - Halver Travel Photos on Instagram - El Cajon Travel Photos