Click to See Complete Forum and Search --> : newbie scripting


L0stm4n
12-10-2000, 07:04 PM
Hi guys new to the forums and linux. I've been reading some bash scripting toots and I cant seem to find stuff for what I want.
I'll give ya a rundown of what I'm doing.
-me and my friend salvaged a buncha parts from a computer store, we built a junk box and loaded linux...well then we got a chance to add bandwidth. now we use it for out own little battleground between us. it's out learning toy. well I had an idea for a little practical joke. A bash script that when he logs in it runs, deletes it'self and and logs him out. what I need is how to a: load from start...bash_profile? then I need to write code to remove that and replace it with bash. b: log him out...since it runs in a subshell it it wont log him out...any way to run it like he typed it? like a source command or something? I'll post my code so far for ya to see.

#!/bin/bash

#sets my user variable
you=$(whoami)
#disable CTRL-C
trap sorry INT
#function sorry()
sorry()
{
echo "I'm sorry $you, your to lame to do that!"
trap '' INT
}

echo "hello $you, your a L4m3r"
sleep 1
#uncomment this to remove the script for maximum confusion
#rm lamer.sh
#rates them on the lameness scale in %
echo "Let's see how lame you are!"
for i in 10 20 30 40 50 60 70 80 90 100; do
echo "You are $i% LAME"
sleep 1;
done
echo "I'm sorry $you your WAY to L4m3 to use this shell, goodbye http://www.linuxnewbie.org/ubb/wink.gif"

#this dont work
logout

------------------
-==C4lm L!ke a b0mb==-

A_Lawn_GNOME
12-10-2000, 08:30 PM
You could try running "killall -9 bash"

It will only have enough permissions to kill his login, not others. (ahh the beauty of multi-user OS's).