Operating System - HP-UX
1752571 Members
5199 Online
108788 Solutions
New Discussion юеВ

Re: Dam script will not work - ;^0

 
SOLVED
Go to solution
John Poff
Honored Contributor

Re: Dam script will not work - ;^0

Ok. It sounds like we should have a Unix command to fix that money problem. Let's try the 'make' command:

make more money
Make: Don't know how to make more. Stop.

Oops. Looks like we're out of luck! ;)

JP
Patrick Wallek
Honored Contributor

Re: Dam script will not work - ;^0

I think I see the impossibility of it all now Paula.

I wish you could get this script to work, though I'd rather be 25. Auto Insurance is cheaper that way. ;)
Madhu Sudhan_1
Respected Contributor

Re: Dam script will not work - ;^0

Paula !

I see a problem where you are using comparison operatos. In Shell there two types of comparison operatos one for numberics and other for strings.
If you are comparing strings use ==, !=, > , < etc.,
If you are comparing numerics use -gt,-ne,-lt,-eq etc.
The script is modified to work.

Thanks,
Madhu
--------
#/bin there done that
##########################################
# One for us :- ;^) PJFC Sep 2001
##########################################
# The next bit
# Age
a=`cat /usr/sysadmin | awk ?{print $1}?`
if test $a ?eq 21
then a=21
fi
##########################################
# Sex
b= `cat /usr/sysadmin | awk ?{print $2}?
if test ?$b? != ?A lot?
then b=?Sex god?
fi
##########################################
# Income
c= `cat /usr/sysadmin | awk ?{print $3}?`
if test ?$c? != ?Not Enough?
then b= ?current x 3?
fi
--------------Cut here-------------------


Think Positive
Paula J Frazer-Campbell
Honored Contributor

Re: Dam script will not work - ;^0

I thought that had fixed it but alas no :-


The errors are:-

age = "You must be joking"

sex = "You are already at limit"

income = "Export cv/resume"

;^0

Paula
If you can spell SysAdmin then you is one - anon
Timothy Czarnik
Esteemed Contributor

Re: Dam script will not work - ;^0

Paula,

This one would be good enough for me...


#/usr/bin/beer #(the little known beer shell)
#####################################
# Beer
beer=0
drinking=TRUE
while [ drinking = TRUE ]
do
if [ beer -ne 24 ]
then
((beer+=1))
else
sleep 3600
beer=0
done


Cheers!

-Tim




Hey! Who turned out the lights!
Madhu Sudhan_1
Respected Contributor

Re: Dam script will not work - ;^0

Paula !
Your script has the following statment
c= ?current x 3?
Here the variable current doesn't have any value neither initialised nor assigned.

Are you trying to multiply current x 3 or are you trying to assign a string "current x 3" ?

...Madhu
Think Positive
Paula J Frazer-Campbell
Honored Contributor

Re: Dam script will not work - ;^0

Hi Timothy

You could perhaps use a get and make in your script.

i.e.

if beer = 0
then get more beer
fi

or
if beer =0
then make beer
fi

Paula
If you can spell SysAdmin then you is one - anon
someone_4
Honored Contributor

Re: Dam script will not work - ;^0

Lets not get into debuging 401k.scr everytime that program runs. It crashes my entire system with the output going to retirement.out always getting lower and lower. I am thinking I need add a sleep command somewhere maybe a
sleep 31536000
and that should fix it for now.

Richard
Paula J Frazer-Campbell
Honored Contributor

Re: Dam script will not work - ;^0

Hi Madhu

Yes I spotted that and defined current as 1 in the script.

;-)

Paula
If you can spell SysAdmin then you is one - anon
John Poff
Honored Contributor

Re: Dam script will not work - ;^0

The 'beer' shell script is a good example of how processes use pipes:

beer | user | bathroom


Of course, there is always my favorite little script (courtesy of thinkgeek.com - they have it on a t-shirt that I'd love to have!)

cd /pub
more beer

JP