![]() |
![]() |
#34 | |
"Ed Hall"
Dec 2009
Adirondack Mtns
2·3·13·67 Posts |
![]() Quote:
Code:
exec <"testcase" while read line do larray=($line) ../../yafu/yafu with some elements of the array done Thanks. |
|
![]() |
![]() |
![]() |
#35 | |
Sep 2002
Database er0rr
2·2,243 Posts |
![]() Quote:
Code:
while read line do larray=($line) ../../yafu/yafu with some elements of the array done < testcase Last fiddled with by paulunderwood on 2021-10-05 at 02:25 |
|
![]() |
![]() |
![]() |
#36 |
"Ed Hall"
Dec 2009
Adirondack Mtns
2×3×13×67 Posts |
![]() Code:
#!/bin/bash a="31363920 948583258055568 -21094061301960794201597 -101781123694367174730692456309" echo "$a" > testcase echo "22$a" >> testcase c="31363920" m="3" printf "\nYAFU says $c*$m is " ../../yafu/yafu "expr($c*$m)" -silent while read line do larray=($line) d=${larray[0]} echo "d is $d" printf "YAFU says $d*$m is " ../../yafu/yafu "expr($d*$m)" -silent done < testcase Code:
YAFU says 31363920*3 is 94091760 d is 31363920 YAFU says 31363920*3 is no variable indicator (@): interpreting batchfile lines as input expressions -101778913424507528108228602338 eof; done processing batchfile I have also tried reading a complete file, but YAFU still seems to act the same. If I can make sure the file is closed after, maybe I can use a two-dimension array and read the entire file into the program and work from there. But, it seems that the flag kruoli pointed out isn't reset once it's opened. Last fiddled with by EdH on 2021-10-05 at 02:44 Reason: Remove #$@! formatting corruption in code block! |
![]() |
![]() |
![]() |
#37 |
Sep 2002
Database er0rr
2·2,243 Posts |
![]() Code:
a="31363920 948583258055568 -21094061301960794201597 -101781123694367174730692456309" echo "$a" > testcase echo "22$a" >> testcase c="31363920" m="3" printf "\nYAFU says $c*$m is " ../../yafu/yafu "expr($c*$m)" -silent readarray matrix < testcase #file now closed for row in "${matrix[@]}";do row_matrix=(${row}) d=${row_matrix[0]} echo "d is $d" printf "YAFU says $d*$m is " ../../yafu/yafu "expr($d*$m)" -silent done Code:
YAFU says 31363920*3 is 94091760 d is 31363920 YAFU says 31363920*3 is 94091760 d is 2231363920 YAFU says 2231363920*3 is 6694091760 Last fiddled with by paulunderwood on 2021-10-05 at 08:02 |
![]() |
![]() |
![]() |
#38 |
"Ed Hall"
Dec 2009
Adirondack Mtns
2·3·13·67 Posts |
![]()
I've successfully coded a stand alone script that works well. I have not attempted to incorporate the code into a function in the main script. Perhaps a little later.
Thanks for all the help. |
![]() |
![]() |
![]() |
#39 |
"Ed Hall"
Dec 2009
Adirondack Mtns
2×3×13×67 Posts |
![]()
Well, unfortunately, in practice, it just doesn't work!
From the command line, the stand alone script works as it should. But, as a function within the bigger script, or as a call to the working script from within the bigger script, YAFU fails to understand. I'm guessing it's just due to the flag being set by something in the bigger script. My work around is fine for now, so I'm not going to spend any more time with it until "maybe" later. Thanks everyone. |
![]() |
![]() |
![]() |
#40 |
"Ed Hall"
Dec 2009
Adirondack Mtns
522610 Posts |
![]()
Just a final note to my "adventure," since there is a conclusion:
First, YAFU was never "portable" enough for my need. I found that even changing to a parallel directory caused it to output differently. Since I intend the script I'm working on to be available to others, I had to give up on YAFU. To be fair, YAFU was not the correct choice from the start for such a task. The good news is that Pari-gp is readily available and much easier to implement for my script. The new code is simply: Code:
ans=$(echo "$d*$m" | gp -q -f) Thanks for all the help from everyone. |
![]() |
![]() |
![]() |
#41 | |
Sep 2002
Database er0rr
2·2,243 Posts |
![]() Quote:
Code:
ans=$(echo "print($d*$m)" | gp -q -f) |
|
![]() |
![]() |
![]() |
#42 |
"Ed Hall"
Dec 2009
Adirondack Mtns
2·3·13·67 Posts |
![]() |
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Startup Script | Gerard | Information & Answers | 2 | 2018-11-01 08:40 |
Simple Script to get Trial Factoring Work | jfamestad | PrimeNet | 3 | 2016-11-06 20:32 |
bash script for extracting primenet-status | gLauss | Linux | 0 | 2010-07-31 11:19 |
Could you help me change this into a bash script? | jasong | Programming | 1 | 2007-11-29 05:59 |
Help with Startup Script | Proggie | Software | 1 | 2004-12-19 11:54 |