Poll

 Please rate this tutorial:

Good
1 (8.3%)
OK
2 (16.7%)
Needs Revision
3 (25%)
Inappropiate
6 (50%)

Total Members Voted: 12

Author Topic: How to write shell scripts in BASIC (Updated)  (Read 2099 times)

fatman2021

  • Hero Member
  • *****
  • Posts: 1169
  • Lord Jesus Christ, Son of God, have mercy on us.
How to write shell scripts in BASIC (Updated)
« on: August 20, 2015, 05:45:23 pm »
Windows users will need to install a  bash compatible terminal emulator/shell such as Cygwin Terminal or Win-Bash:

https://www.cygwin.com/

http://win-bash.sourceforge.net/

QB64:

Code: [Select]
echo '
$CONSOLE
$SCREENHIDE
_DEST _CONSOLE
PRINT "Hello World!"
'>tmp.bas; ./qb64 -c tmp.bas; ./tmp; rm ./tmp


Code: [Select]
echo '
screen 13
for x = 0 to 319
 for y = 0 to 199
  pset(x, y), x mod 255
 next y
next x'>tmp.bas; ./qb64 -c tmp.bas; ./tmp; rm ./tmp

Other BASICS's:

Arch-based linux distros...
   
Step 1: Install a BASIC interrupter:
 
Code: [Select]
yaourt -S bas
Step 2: Create a shell script using your text editor of choice(ex: basic.sh):

Code: [Select]
leafpad basic.sh
Code: [Select]
echo '

COLOR 1: PRINT "H";
COLOR 3: PRINT "E";
COLOR 4: PRINT "L";
COLOR 5: PRINT "L";
COLOR 6: PRINT "O"
COLOR 0: PRINT
COLOR 9: PRINT "W";
COLOR 11: PRINT "O";
COLOR 12: PRINT "R";
COLOR 13: PRINT "L";
COLOR 14: PRINT "D"
COLOR 15: PRINT
END
'>tmp.bas; bas tmp.bas; rm ./tmp.bas

Step 3: Make shell script executable:

Code: [Select]
chmod +x basic.sh
Step: Execute shell script:
 
Code: [Select]
./basic.sh
Debian-based linux distros...
   
Step 1: Install a BASIC interrupter:
 
Code: [Select]
sudo apt-get install bwbasic
Step 2: Create a shell script using your text editor of choice(ex: basic.sh):

Code: [Select]
leafpad basic.sh
Code: [Select]
bwbasic <<'EOF'
PRINT "Hello World!"
EOF

Step 3: Make shell script executable:

Code: [Select]
chmod +x basic.sh
Step: Execute shell script:
 
Code: [Select]
./basic.sh
« Last Edit: March 01, 2016, 01:48:48 pm by fatman2021 »
Woe to those who call evil good, and good evil;
Who put darkness for light, and light for darkness;
Who put bitter for sweet, and sweet for bitter!

Isaiah 5:20