Bitcoin Forum
May 04, 2024, 06:52:54 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Any ideea?  (Read 551 times)
john85gotti (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
December 03, 2016, 11: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.
1714805574
Hero Member
*
Offline Offline

Posts: 1714805574

View Profile Personal Message (Offline)

Ignore
1714805574
Reply with quote  #2

1714805574
Report to moderator
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714805574
Hero Member
*
Offline Offline

Posts: 1714805574

View Profile Personal Message (Offline)

Ignore
1714805574
Reply with quote  #2

1714805574
Report to moderator
1714805574
Hero Member
*
Offline Offline

Posts: 1714805574

View Profile Personal Message (Offline)

Ignore
1714805574
Reply with quote  #2

1714805574
Report to moderator
1714805574
Hero Member
*
Offline Offline

Posts: 1714805574

View Profile Personal Message (Offline)

Ignore
1714805574
Reply with quote  #2

1714805574
Report to moderator
Vod
Legendary
*
Offline Offline

Activity: 3696
Merit: 3064


Licking my boob since 1970


View Profile WWW
December 04, 2016, 08: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.

https://nastyscam.com - landing page up     https://vod.fan - advanced image hosting - coming soon!
OGNasty has early onset dementia; keep this in mind when discussing his past actions.
Joel_Jantsen
Legendary
*
Offline Offline

Activity: 1862
Merit: 1308

Get your game girl


View Profile
December 04, 2016, 08:47:55 AM
 #3

What is this ?

Code:
id=$1

Where is the for-loop ?
john85gotti (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
December 04, 2016, 08:49:51 AM
 #4

Yes, you are right, but i don't know where to put it
TooQik
Sr. Member
****
Offline Offline

Activity: 337
Merit: 258


View Profile
December 04, 2016, 08: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.
Joel_Jantsen
Legendary
*
Offline Offline

Activity: 1862
Merit: 1308

Get your game girl


View Profile
December 04, 2016, 08: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
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!