Fedora Linux Support Community & Resources Center
  #1  
Old 20th July 2012, 03:07 PM
steveking Offline
Registered User
 
Join Date: Apr 2012
Location: Surrey
Posts: 52
linuxubuntufirefox
Matrix Style bash script

This script isn't all mine for the record! Simply unzip and run enter.sh in your terminal. Make sure you try both pills!!
Attached Files
File Type: zip matrix.zip (2.4 KB, 114 views)
Reply With Quote
  #2  
Old 20th July 2012, 03:48 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,661
linuxfirefox
Re: Matrix Style bash script

No screenshots?

scripts to run blind?

I think not.
Reply With Quote
  #3  
Old 20th July 2012, 03:59 PM
steveking Offline
Registered User
 
Join Date: Apr 2012
Location: Surrey
Posts: 52
linuxubuntufirefox
Re: Matrix Style bash script

ok let me take a screen shot or two
Reply With Quote
  #4  
Old 20th July 2012, 04:05 PM
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 5,457
linuxfedorafirefox
Re: Matrix Style bash script

Here's a far less complicated poor man's one-liner version:
Code:
echo -e "\033[1;32m" && yes $(cat /bin/cat | hexdump -c) | hexdump -c
__________________
OS: Fedora 20 x86_64 | Machine: HP Pavilion a6130n | CPU: AMD 64 X2 Dual-Core 5000+ 2.6GHz | RAM: 5GB PC5300 DDR2 | Disk: 400GB SATA | Video: ATI Radeon HD 4350 512MB | Sound: Realtek ALC888S | Ethernet: Realtek RTL8201N
Reply With Quote
  #5  
Old 20th July 2012, 04:15 PM
steveking Offline
Registered User
 
Join Date: Apr 2012
Location: Surrey
Posts: 52
linuxubuntufirefox
Re: Matrix Style bash script

Stuff the screenshots being a pain! I will post the code instead!

---------- Post added at 04:12 PM ---------- Previous post was at 04:11 PM ----------

enter.sh

#!/bin/bash

# Declare variable choice and assign value 3
choice=3
# Print to stdout
echo "1. Take the Blue Pill"
echo "2. Take the Red Pill"
echo -n "Choose Blue or Red? "
# 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 -eq 1 ] ; then

echo "You have chosen The Blue Pill"
sleep 1
./matrix.sh

else

if [ $choice -eq 2 ] ; then
echo "You have chosen The Red Pill"
sleep 1
echo "Trying to find the Red Pill."
sleep .1
echo "Trying to find the Red Pill.."
sleep 1
echo "Still trying to find the Red Pill..."
sleep .1
echo "Still trying to find the Red Pill...."
sleep 1
echo "Unfortunately it has been replaced with The Hormone Pill, you shall now grow breasts"

else
echo "Choose Blue or Red? !"
echo "1. Take the Blue Pill"
echo "2. Take the Red Pill"
echo -n "Choose Blue or Red? "
choice=3
fi
fi

done

---------- Post added at 04:12 PM ---------- Previous post was at 04:12 PM ----------

matrix.sh

#!/bin/bash
clear
virtcent=$((`tput lines`/2))
horcent=$((`tput cols`/2-10))
tput setf 6
tput cup $virtcent $horcent && echo "entering the matrix"
sleep 1
tput cup $virtcent $horcent && echo " "
sleep 1
tput cup $virtcent $horcent && echo "entering the matrix"
sleep 1
tput cup $virtcent $horcent && echo " "
sleep 1
tput cup $virtcent $horcent && echo "connecting. "
sleep .1
tput cup $virtcent $horcent && echo "connecting.. "
sleep .1
tput cup $virtcent $horcent && echo "connecting... "
sleep .1
tput cup $virtcent $horcent && echo "connecting.... "
sleep .1
tput cup $virtcent $horcent && echo "connecting..... "
sleep .1
tput cup $virtcent $horcent && echo "connecting...... "
sleep .1
tput cup $virtcent $horcent && echo "connecting....... "
sleep .1
tput cup $virtcent $horcent && echo "connecting....... "
sleep .1
tput cup $virtcent $horcent && echo "connecting....... "
sleep .1
tput cup $virtcent $horcent && echo "connecting........ "
sleep .1
tput cup $virtcent $horc#!/bin/bash
clear
virtcent=$((`tput lines`/2))
horcent=$((`tput cols`/2-10))
tput setf 6
tput cup $virtcent $horcent && echo "entering the matrix"
sleep 1
tput cup $virtcent $horcent && echo " "
sleep 1
tput cup $virtcent $horcent && echo "entering the matrix"
sleep 1
tput cup $virtcent $horcent && echo " "
sleep 1
tput cup $virtcent $horcent && echo "connecting. "
sleep .1
tput cup $virtcent $horcent && echo "connecting.. "
sleep .1
tput cup $virtcent $horcent && echo "connecting... "
sleep .1
tput cup $virtcent $horcent && echo "connecting.... "
sleep .1
tput cup $virtcent $horcent && echo "connecting..... "
sleep .1
tput cup $virtcent $horcent && echo "connecting...... "
sleep .1
tput cup $virtcent $horcent && echo "connecting....... "
sleep .1
tput cup $virtcent $horcent && echo "connecting....... "
sleep .1
tput cup $virtcent $horcent && echo "connecting....... "
sleep .1
tput cup $virtcent $horcent && echo "connecting........ "
sleep .1
tput cup $virtcent $horcent && echo "connecting........."
sleep 1
tput cup $virtcent $horcent && echo " CONNECTED "
sleep 1
clear



tput setf 2
lines="$(tput lines)"
col="$(tput cols)"
for i in $(seq 1 200) ; do
max1=$((RANDOM%3))
max=$(($lines-$max1))
declare -a char1
char1=(`~/matrix/matrix_char.sh`)
declare -a char2
char2=(`~/matrix/matrix_char.sh`)
declare -a char3
char3=(`~/matrix/matrix_char.sh`)
declare -a char4
char4=(`~/matrix/matrix_char.sh`)
declare -a char5
char5=(`~/matrix/matrix_char.sh`)
declare -a char6
char6=(`~/matrix/matrix_char.sh`)
declare -a char7
char7=(`~/matrix/matrix_char.sh`)
declare -a char8
char8=(`~/matrix/matrix_char.sh`)
declare -a char9
char9=(`~/matrix/matrix_char.sh`)
declare -a char10
char10=(`~/matrix/matrix_char.sh`)

l=$((RANDOM%$lines))
l2=$((RANDOM%$lines))
l3=$((RANDOM%$lines))
l4=$((RANDOM%$lines))
l5=$((RANDOM%$lines))
l6=$((RANDOM%$lines))
l7=$((RANDOM%$lines))
l8=$((RANDOM%$lines))
l9=$((RANDOM%$lines))
l10=$((RANDOM%$lines))
c=$((RANDOM%$col))
c2=$((RANDOM%$col))
c3=$((RANDOM%$col))
c4=$((RANDOM%$col))
c5=$((RANDOM%$col))
c6=$((RANDOM%$col))
c7=$((RANDOM%$col))
c8=$((RANDOM%$col))
c9=$((RANDOM%$col))
c10=$((RANDOM%$col))

while [ $l -lt $max ] ; do
tput cup $l $c
echo ${char1[${l}]}
if [ $l2 -lt $max ] ; then
tput cup $l2 $c2
echo ${char2[${l}]}
fi
if [ $l3 -lt $max ] ; then
tput cup $l3 $c3
echo ${char3[${l}]}
fi
if [ $l4 -lt $max ] ; then
tput cup $l4 $c4
echo ${char4[${l}]}
fi
if [ $l5 -lt $max ] ; then
tput cup $l5 $c5
echo ${char5[${l}]}
fi
if [ $l6 -lt $max ] ; then
tput cup $l6 $c6
echo ${char6[${l}]}
fi
if [ $l7 -lt $max ] ; then
tput cup $l7 $c7
echo ${char7[${l}]}
fi
if [ $l8 -lt $max ] ; then
tput cup $l8 $c8
echo ${char8[${l}]}
fi
if [ $l9 -lt $max ] ; then
tput cup $l9 $c9
echo ${char9[${l}]}
fi
if [ $l10 -lt $max ] ; then
tput cup $l10 $c10
echo ${char10[${l}]}
fi


l=$(($l+1))
l2=$(($l2+1))
l3=$(($l3+1))
l4=$(($l4+1))
l5=$(($l5+1))
l6=$(($l6+1))
l7=$(($l7+1))
l8=$(($l8+1))
l9=$(($l9+1))
l10=$(($l10+1))
done
done


ent && echo "connecting........."
sleep 1
tput cup $virtcent $horcent && echo " CONNECTED "
sleep 1
clear



tput setf 2
lines="$(tput lines)"
col="$(tput cols)"
for i in $(seq 1 200) ; do
max1=$((RANDOM%3))
max=$(($lines-$max1))
declare -a char1
char1=(`~/matrix/matrix_char.sh`)
declare -a char2
char2=(`~/matrix/matrix_char.sh`)
declare -a char3
char3=(`~/matrix/matrix_char.sh`)
declare -a char4
char4=(`~/matrix/matrix_char.sh`)
declare -a char5
char5=(`~/matrix/matrix_char.sh`)
declare -a char6
char6=(`~/matrix/matrix_char.sh`)
declare -a char7
char7=(`~/matrix/matrix_char.sh`)
declare -a char8
char8=(`~/matrix/matrix_char.sh`)
declare -a char9
char9=(`~/matrix/matrix_char.sh`)
declare -a char10
char10=(`~/matrix/matrix_char.sh`)

l=$((RANDOM%$lines))
l2=$((RANDOM%$lines))
l3=$((RANDOM%$lines))
l4=$((RANDOM%$lines))
l5=$((RANDOM%$lines))
l6=$((RANDOM%$lines))
l7=$((RANDOM%$lines))
l8=$((RANDOM%$lines))
l9=$((RANDOM%$lines))
l10=$((RANDOM%$lines))
c=$((RANDOM%$col))
c2=$((RANDOM%$col))
c3=$((RANDOM%$col))
c4=$((RANDOM%$col))
c5=$((RANDOM%$col))
c6=$((RANDOM%$col))
c7=$((RANDOM%$col))
c8=$((RANDOM%$col))
c9=$((RANDOM%$col))
c10=$((RANDOM%$col))

while [ $l -lt $max ] ; do
tput cup $l $c
echo ${char1[${l}]}
if [ $l2 -lt $max ] ; then
tput cup $l2 $c2
echo ${char2[${l}]}
fi
if [ $l3 -lt $max ] ; then
tput cup $l3 $c3
echo ${char3[${l}]}
fi
if [ $l4 -lt $max ] ; then
tput cup $l4 $c4
echo ${char4[${l}]}
fi
if [ $l5 -lt $max ] ; then
tput cup $l5 $c5
echo ${char5[${l}]}
fi
if [ $l6 -lt $max ] ; then
tput cup $l6 $c6
echo ${char6[${l}]}
fi
if [ $l7 -lt $max ] ; then
tput cup $l7 $c7
echo ${char7[${l}]}
fi
if [ $l8 -lt $max ] ; then
tput cup $l8 $c8
echo ${char8[${l}]}
fi
if [ $l9 -lt $max ] ; then
tput cup $l9 $c9
echo ${char9[${l}]}
fi
if [ $l10 -lt $max ] ; then
tput cup $l10 $c10
echo ${char10[${l}]}
fi


l=$(($l+1))
l2=$(($l2+1))
l3=$(($l3+1))
l4=$(($l4+1))
l5=$(($l5+1))
l6=$(($l6+1))
l7=$(($l7+1))
l8=$(($l8+1))
l9=$(($l9+1))
l10=$(($l10+1))
done
done

---------- Post added at 04:13 PM ---------- Previous post was at 04:12 PM ----------

matrix_char.sh

#!/bin/bash
for i in `cat ~/matrix/matrix.in ` ; do echo "$RANDOM .$i " ; done | sort -rn | awk '{print $2}' | sed -e '1{$p;x;d;}' -e '/^NEW/!{H;$!d;x;s/\n//g;b;}' -e 'x;s/\n//g;${p;x;}' | sed 's/\./ /g'

---------- Post added at 04:13 PM ---------- Previous post was at 04:13 PM ----------

matrix.sh

1
2
3
4
5
6
7
8
9
0
!
@
#
$
%
^
&
(
)
!
@
#
$
%
^
&
(
)
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
,
.
/
;
'
[
]
\
`
~
{
}
:
"
<
>
?
,
.
/
;
'
[
]
\
`
~
{
}
:
"
<
>
?

---------- Post added at 04:14 PM ---------- Previous post was at 04:13 PM ----------

It is important that you save these files in a folder called "matrix" in your home directory unless you want to go through all the code and change file paths!

---------- Post added at 04:15 PM ---------- Previous post was at 04:14 PM ----------

Quote:
Originally Posted by RupertPupkin View Post
Here's a far less complicated poor man's one-liner version:
Code:
echo -e "\033[1;32m" && yes $(cat /bin/cat | hexdump -c) | hexdump -c
This works but it is too fast, to get the right effect you need more timing controls, but i take my hat off to your one liner!
Reply With Quote
Reply

Tags
bash, matrix, script, style

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
Bash Script Help Jamwa Using Fedora 5 17th June 2008 05:26 PM
Bash scripting help - printing text on screen old-school style tonyingesson Linux Chat 1 4th October 2006 10:44 PM
Convert bash script to perl script homey Programming & Packaging 1 2nd September 2006 04:24 AM
Bash Script on FC3 Clunixchit Programming & Packaging 7 8th April 2005 09:29 PM


Current GMT-time: 18:10 (Friday, 18-04-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