thanks so far Richard
I now have a command that when used at the command prompt runs my program
sudo /home/xxx/yyy/zzz/program
The problem was that the command does not like haveing spaces in the folder/file names. Theres nothing like trial and eror.
However, when i put this into the rc.local file it does not work or throw up any errors.
Kind regards Ric
Launch BASIC program on PI BOOT
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Launch BASIC program on PI BOOT
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
- JeremyNicoll
- Posts: 72
- Joined: Sun 26 Jul 2020, 22:22
- Location: Edinburgh
Re: Launch BASIC program on PI BOOT
NOTE: I know /nothing/ about use of Raspberry Pis.
But ... are you sure nothing happens? Or could you perhaps mean that something may well happen but you don't see it? I suppose there's no point in asking you to check the logs (assuming such things exist) to see if the command WAS issued, whether it did anything at all, or issued some sort of error message...?
But I question whether you really want to run the program AT BOOT. That would make sense if you were setting up a process / service to run all by itself long before anyone logs in. But if you do that, where would you expect the output - if any - to go? To a file?
Maybe you really want the program to run and display something to YOU after you have logged in?
Putting that another way, you should be able to experiment with commands issued from a terminal window (when you are logged in) to make your program run. Once you know what command makes it work as you require THEN go on to find a way to have it happen by magic.
According to the webpage with the list of methods, this method IS for running something just after you login and bash is being set up.
If the directory doesn't exist, look closely at your spelling - assuming that what you wrote here isn't what you actually did write ie that your "hpme" is a typo.
If the spelling is right, google for how to find ".bashrc" on your OS.
If you're issuing commands like "sudo" surely this IS linux? Or something very like it.
NO, it is 'crontab' - the table of commands to be run by 'cron' which is a service that issues commands on a timed basis ("cron" as in "chronometer")
You need to find a command that runs the thing when you issue it in a terminal window, before trying to automate that.
ALSO ... why are you issuing "sudo" in your commands? Does your program need to run with root authority? And even if it does ... it's possible that any command run by sudo will not see the same set of mount points or directories, nor have the same permissions, as a command not run under sudo. That would mean that anything tested under a normal userid might not work (or will work differently) under sudo. If I were doing something like that I'd have my program generate a log file which I could subsequently read to see what it was doing.
I think your main problem is knowing hardly anything about what the R Pi OS does as it starts, and where the various points in that are at which you can insert commands you want run. There's no point issuing a command that (say) presents a GUI if there's not yet a windowing environment defined, or - if there is one - that YOU the user won't ever see. Starting something at BOOT is like starting a firewall or antivirus app (in Windows) as soon as Windows boots, long before any ordinary user logs in. Some people need to do that, but I'd expect anyone wanting to do that to have knowledge that I don't think you've got.
-
- Posts: 37
- Joined: Thu 05 Apr 2018, 14:08
Re: Launch BASIC program on PI BOOT
If your filesystem allows spaces in filenames, to specify them in a command you need to enclose them in quotes, otherwise the command line has no way of knowing where the filename ends.
$ fred jim sheila
How does it know you want to run a program called fred passing it jim sheila as parameters, or a program called fred jim passing it sheila as a parameter? Or even a program called fred jim sheila with no parameters?
"\My Programs\My Code\Funcky Program" "\My Data\Input data\File 1.dat" -title "A title string" title "another string" ...
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Launch BASIC program on PI BOOT
Fair play.
Kind regards Ric
Kind regards Ric
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
- JeremyNicoll
- Posts: 72
- Joined: Sun 26 Jul 2020, 22:22
- Location: Edinburgh
Re: Launch BASIC program on PI BOOT
Absolute means the whole path is specified, from (in linux) the mount point (eg "/etc" or "/home") or in WIndows starting with the disk letter eg "C:\" right through to the entire leafname of the file concerned, or if it's a directory the rightmost part of the directory name.
Not doing so means one gives a relative filename, ie a partial name that is meant to be understood in relation to some assumption - it might be relative to the "current directory" or perhaps to some other directory that makes sense to some program (eg a standard place where that program looks for its sample data files).
I've aways used full or absolute pathnames / filenames for every file I refer to in programmes. It removes one potential problem - that the implied path (if one uses relative names) isn't what the programmer thought it would be. For example on Windows a program running (via UAC) "as Administrator" will implicitly see directories owned by the Admin id not the id who ran the program. It's the sort of thing that makes a program run as a cheduled task not work the same way as one run by an ordinary user.
Typically also I check that the directory that a file is meant to be in (or is to be placed in) actually exists, so instead of later getting a "file not found" error if "<somedir>\thatfile" can't be found because the <somedir>" part is wrong, I can issue a "no such directory" error message.
I also ALWAYS wrap ALL file paths in double quotes, not just ones which I can see contain spaces. If you always do it you never forget to do it in odd cases.
Some older programs (utilities, often) are written on the ancient assumption that there's no spaces in any part of any of their files' paths. This quite often affects languages eg I'm sure I remember installing a version of perl under Windows where perl's path had to start in C:\ ie something like "C:\ThisPerl\" because if one installed it in the "standard" location: "C:\Program Files (x86)" the spaces in that directory's name would prevent that perl from working properly.
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Launch BASIC program on PI BOOT
A slightly muted woohoo. After a lot of messing about I finally got the Pi to boot a bbcsdl.exe.
That was the upside, then i realised id left the "ON ERROR" statement in which basically starts the program again on error, this has caused me a bit of a headache beacause the window doesnt open and there is no quit cross, i cant stop it and it was only a test run and now i cant access my rpi. Ho Hum. Ill look in to booting in to safe mode or something equivalent and report back.
Thanks for the help guys, be back soon.
That was the upside, then i realised id left the "ON ERROR" statement in which basically starts the program again on error, this has caused me a bit of a headache beacause the window doesnt open and there is no quit cross, i cant stop it and it was only a test run and now i cant access my rpi. Ho Hum. Ill look in to booting in to safe mode or something equivalent and report back.
Thanks for the help guys, be back soon.
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
- Posts: 41
- Joined: Sat 28 May 2022, 22:40
Re: Launch BASIC program on PI BOOT
"the window doesnt open and there is no quit cross, i cant stop it and it was only a test run and now i cant access my rpi. Ho Hum. Ill look in to booting in to safe mode"
Am I missing something?
Can you not just put the SD card into a computer and edit the boot script, or rename the executable so that next time the RPI tries to load it, a file not found error halts it?
Am I missing something?
Can you not just put the SD card into a computer and edit the boot script, or rename the executable so that next time the RPI tries to load it, a file not found error halts it?
Started using BASIC circa 1981 with CP/M, Video Genie, Sinclair ZX81, Acorn Atom, and progressed with ZX Spectrum, BBC Micro and Sinclair QL, Cambridge Z88, DOS, Windows. Wrote A-level project using school's BBC Micro with dual 800K floppy drive.
-
- Posts: 272
- Joined: Tue 18 Jun 2024, 09:32
Re: Launch BASIC program on PI BOOT
Another possibility would be to telnet into your Raspberry Pi from a remote terminal (e.g. PuTTY running on a PC) and kill the BBC BASIC process.
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Launch BASIC program on PI BOOT
Thanks for the suggestions guys, but you miss the point about I dont know how to do that stuff. I have just re imaged the sd card and all is well.
Kind regards Ric
Kind regards Ric
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
- Posts: 272
- Joined: Tue 18 Jun 2024, 09:32
Re: Launch BASIC program on PI BOOT
No, I didn't miss any point! We now have amazing and almost unlimited sources of information available at our fingertips, from search engines like Google and AI Assistants like ChatGPT.

So if for example I say you can "telnet into your Raspberry Pi" I know that you will be able to type that phrase into one of those engines and be told everything you could possibly need to know about what it means and how to do it!
This makes it much easier to answer questions at forums such as this, because it is no longer necessary to make any allowance for your level of existing knowledge or experience, so long as what is suggested is sufficient for you to look up what you need to know.

Indeed forums have largely become redundant because in many cases you could just ask your question of ChatGPT or Copilot or Gemini etc. and get the answer immediately. Only when it's so specific to BBC BASIC (or one of its variants) that the general purpose AI Assistants can't answer it does this forum still have a value.
But eventually they will (probably) get so good that dedicated forums are not required at all. Even now the best AIs can write code to achieve a particular result - even in BBC BASIC - which nearly works and only needs a little tweaking.
