Author

Topic: Any ideea? (Read 559 times)

legendary
Activity: 1988
Merit: 1317
Get your game girl
December 04, 2016, 04:55:13 AM
#6
What is this ?

Code:
id=$1

Where is the for-loop ?

Edit : Put your CURRENTSTREAK,both the if conditions inside a for loop.
Syntax :
Code:
for VARIABLE in file1 file2 file3
do
command1 on $VARIABLE
command2
commandN
done
sr. member
Activity: 337
Merit: 258
December 04, 2016, 04:50:12 AM
#5
I'd say you're calling nrsteak=0 EVERY time your code is called, so you're always either adding or subtracting one from 0.
newbie
Activity: 8
Merit: 0
December 04, 2016, 04:49:51 AM
#4
Yes, you are right, but i don't know where to put it
legendary
Activity: 1988
Merit: 1317
Get your game girl
December 04, 2016, 04:47:55 AM
#3
What is this ?

Code:
id=$1

Where is the for-loop ?
Vod
legendary
Activity: 3668
Merit: 3010
Licking my boob since 1970
December 04, 2016, 04:43:37 AM
#2
1) This is a bitcoin forum, not a coding forum
2) You posted in off topic; coders probably don't read here
3) You didn't include a proper subject to attract the proper attention.
newbie
Activity: 8
Merit: 0
December 03, 2016, 07:27:30 PM
#1
Hey, i'm new on codeing and i am stuck
I have a code in bash and i want to make it to increment or decrement, but i can t make it right
When i run the script, it\s workin' but increments only 1 number
Exemple:
1
1
1
1


This is the code

Code:
#!/bin/bash#
#Alchimie Fibonacci




nrstreak=0
bet=0.00000000




id=$1




echo "BET $bet"
won=`./bet 0.1 49 "<"`




############# CURRENTSTREAK #######################
if [ "$won" == "true" ] && [ "$nrstreak" -ge 0 ];
then
((nrstreak++))
echo "WON! +++"
elif [ "$won" == "true" ] && [ "$nrstreak" -lt 0 ];
then
echo "WON!"
fi






if [[ "$won" == "false" && "$nrstreak" -le 0 ]];
then
((nrstreak--))
echo "LOSE! ---"
elif [[ "$won" == "false" && "$nrstreak" -gt 0 ]];
then
echo "LOSE!"
fi
####################################################




echo "Nr_Streak = $nrstreak"


echo "---------------------------"
sleep 0.5



This in the result

Code:
BET 0.1
LOSE!
Nr_Streak = -1
---------------------------
BET 0.1
LOSE!
Nr_Streak = -1
---------------------------
BET 0.1
WON!
Nr_Streak = 1
---------------------------
BET 0.1
WON!
Nr_Streak = 1
---------------------------








Thank you, please excuse my bad english.
Jump to: