Program for running BASIC one-liners from the TH prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 rem bas.bas - by underwood | |
1 rem usage: bas <single line of BASIC code> | |
10 if left$(arg$,1) = " " then arg$ = mid$(arg$,1) : goto 10 | |
20 if asc(left$(arg$,1)) > 47 and asc(left$(arg$,1)) < 58 then arg$ = mid$(arg$,1) : goto 10 | |
21 rem strip leading spaces and line numbers | |
30 arg$ = "1 " + arg$ | |
31 rem prepend our line with line number 1 | |
40 & chr$(27) + "[A" + chr$(27) + "[2K" ; | |
41 rem go up 1 line and clear it | |
50 f$ = left$(th_md5hex$(th_localtime$),8) | |
60 flnam$ = f$ + ".bas" | |
61 rem make a temporary filename | |
70 open flnam$, as #1 | |
71 rem open our temporary file | |
80 &# 1, "0 ? chr$(27) + " + chr$(34) + "[A" + chr$(34) + " + chr$(27) + " + chr$(34) + "[2K" + chr$(34) + ";" | |
81 rem see line 41 | |
90 &# 1, arg$ | |
91 rem write our line to the file | |
100 close #1 | |
110 cmd$ = "run " + flnam$ : th_exec cmd$ | |
111 rem execute our temporary file | |
120 cmd$ = "rm " + flnam$ : th_exec cmd$, stderr$ | |
121 rem delete the temporary file |
Author
thunderpoot
commented
Jan 9, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment