Search Results

Search: Posts Made By: cogiz
4,456
Posted By Don Cragun
While this happens to work with the sample array...
While this happens to work with the sample array provided, asking to print 9 elements starting with index 8 seems to be a strange way to print the last two elements of an array of 10 elements. If...
998
Posted By RudiC
Running your final for loop with the variables...
Running your final for loop with the variables (not arrays!) set to the values indicated, I get 0 0 0 9H KC 0 7C 9S, so the logics seem to be OK. The inconsistent behaviour might be caused by some...
998
Posted By Scrutinizer
To start with: username=cogiz #!/bin/bash ...
To start with:
username=cogiz
#!/bin/bash

should be:
#!/bin/bash
username=cogiz

try:

A=${X[@]::1}
B=${X[@]:1}

or:

read X < /home/cogiz/activecard.txt # instead of...
1,521
Posted By greet_sed
Hi, No, you can't. Because element is...
Hi,



No, you can't. Because element is removed from array.

See the example:
X=(2H 4S 10D QC)
$ echo ${X[2]}
10D
$ unset X[2]
$ echo ${X }
2H 4S QC

Here X[2] is QC
1,619
Posted By Aia
for e in ${computerhand[@]}; do if [[ $e =~...
for e in ${computerhand[@]}; do
if [[ $e =~ 6|D ]]; then
echo "$e" >> test.output
fi
done


#!/bin/bash

computerhand=(6H 2C JC QS 9D 3H 8H 4D)
topcard=6D
...
3,641
Posted By Scrutinizer
The problem is in the two following lines: ...
The problem is in the two following lines:
computerdeal 8 | sed -r 's/[0123456789JQKAHSDC]+/ * /g'
and
echo " The Card in Play is: "$(deal) | tee /home/cogiz/cardinplay.txt

In both...
1,180
Posted By RudiC
Why don't you create the array dynamically, by...
Why don't you create the array dynamically, by e.g. using the output of seq? You'd still need to keep the starting value somewhere.

What kind of logics do you wish to apply when the days reach...
1,180
Posted By Don Cragun
Your current code explicitly initializes the...
Your current code explicitly initializes the array using:
days=(9 8 7 6 5)
If you want to update the array and load those updated values the next time you run your script, you need to save the...
Showing results 1 to 8 of 8

 
All times are GMT -4. The time now is 05:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy