cancel
Showing results for 
Search instead for 
Did you mean: 

Dam script will not work - ;^0

SOLVED
Go to solution
Paula J Frazer-Campbell
Honored Contributor

Dam script will not work - ;^0

Hi to all

I have written a new script but no matter how I try it will not work.

I have set it to 755 and it is owned by me but still refuses to carry out its commands.

Any suggestion or other scripts gratefully received.

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


Paula
If you can spell SysAdmin then you is one - anon
33 REPLIES
Sridhar Bhaskarla
Honored Contributor

Re: Dam script will not work - ;^0

Paula...


Are you missing a quote at the end of
your a's definition??

b's definition.. c' definition also...


a=`cat /usr/sysadmin | awk '{print $1}'`

Try with these correct quotes for other variable settings also.

-Sri

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: Dam script will not work - ;^0

Hmmm... Lemme try it...

#Aged
a=`cat /usr/sysadmin |awk '{print $1}'`
if [ $a != 21 ]
then
a=21
fi

#Sexed

b=`cat /usr/sysadmin|awk '{print $2}'`
if [ "$b" = "A lot" ]
then
b="Sex God"
fi

#Incame

c=`cat /usr/sysadmin |awk '{print $3}'`
if [ "$c" != "Not Enough" ]
then
b="current x 3"
fi

try this and see if it works?.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Paula J Frazer-Campbell
Honored Contributor

Re: Dam script will not work - ;^0

Hi Sridhar

I have put the quote in but still problems

Read the script and what it is trying to do --

It is just for fun.

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


xxx

Paula
If you can spell SysAdmin then you is one - anon
A. Clay Stephenson
Acclaimed Contributor

Re: Dam script will not work - ;^0

Methinks Paula is grinning us.
If it ain't broke, I can fix that.
Paula J Frazer-Campbell
Honored Contributor

Re: Dam script will not work - ;^0

It looks like we might be getting there


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

Re: Dam script will not work - ;^0

Hmmm,

I get the following message when I type in 'sex':

sex: not found

Sounds about right.

The multiplier for your salary seems low. I'd try upping it to x 5.

:)

JP
Sridhar Bhaskarla
Honored Contributor

Re: Dam script will not work - ;^0

Hmmmmmmmmm!!!!!

See meee :-(
You may be disappointed if you fail, but you are doomed if you don't try
Paula J Frazer-Campbell
Honored Contributor

Re: Dam script will not work - ;^0

Hi John

I have tried the x5 but all I get is: -

Insufficient recourses

I have looked in money.log and the last entry is a negative value could this be the problem.


>>;-0

paula


If you can spell SysAdmin then you is one - anon
Patrick Wallek
Honored Contributor

Re: Dam script will not work - ;^0

Let's see now:

Step 1: We should all be 21
Step 2: We should all be sex gods or goddesses
Step 3: We should all be making triple what we are making now

Sounds good to me!!!!!!!!!
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
Madhu Sudhan_1
Respected Contributor

Re: Dam script will not work - ;^0

Ok, then replace c="current X 3" with c=`expr $current \* 3`

...Madhu
Think Positive
James R. Ferguson
Acclaimed Contributor

Re: Dam script will not work - ;^0

Hi Paula:

Judging from the responses (and I admit, I first looked at this post from a syntatic view too!) I can't help but wonder what this says about us! ;-)

Timothy, loops such as those you suggest are detrimental to processors ...

Paula, we can always count on you to provide much needed levity in an otherwise all too serious day!

Regards to all!

...JRF...
Paula J Frazer-Campbell
Honored Contributor

Re: Dam script will not work - ;^0

Hi Richard

Why not do a sleep until

ie.e.

Sleep until interested
or
Sleep until retirement
or
Sleep until sex = possible
or
Sleep until lottery = win

Paula
If you can spell SysAdmin then you is one - anon
Madhu Sudhan_1
Respected Contributor

Re: Dam script will not work - ;^0

Can we get to see /usr/sysadmin file ?

...Madhu
Think Positive
linuxfan
Honored Contributor

Re: Dam script will not work - ;^0

Hi Paula,

This always work for me

==========Cut here============
while true
do
sleep 1
done
==========Cut here============

-Ramesh

They think they know but don't. At least I know I don't know - Socrates