BBCSDL and OSCLI and cp

Here you can talk about anything related to BBC BASIC, not covered in another category
SteveF
Posts: 3
Joined: Tue 18 Dec 2018, 20:23

BBCSDL and OSCLI and cp

Post by SteveF »

I know this seems too easy but I can not get the copy "cp" command to work with OSCLI. Does anyone have an example that works?

Here's a small sample of what I tried that doesn't work

Code: Select all

PRINT "Start"
      INPUT k$

      REM works - just to check if everything OK
      REM OSCLI "ldattach " + "-1 -8 -n -s 9600 0 /dev/serial0 " + ";"
      REM INPUT k$

      REM works - Script to kill ldattach process - just to check if everything OK
      REM OSCLI "*/home/pi/software/frag.sh"
      REM INPUT k$

      REM no work SYNTAX ERROR
      REM OSCLI  "cp """+/home/pi/software/lcd0.sh+""" """+/home/pi/software/lcd0cp.txt+""""
      REM INPUT k$

      REM works but won't copy into /boot directory
      REM *COPY /home/pi/software/lcd0.sh /home/pi/software/clcd0cp.txt
      REM INPUT k$

      REM no work BAD COMMAND
      REM OSCLI  "cp /home/pi/software/lcd0.sh /home/pi/software/lcd0cp.txt"
      REM INPUT k$

      REM no work BAD COMMAND - script works fine from command line
      REM OSCLI "*/home/pi/software/lcd0.sh"
      REM INPUT k$

      REM no work BAD COMMAND - script works fine from command line
      REM OSCLI "sh /home/pi/software/lcd0.sh"
      REM INPUT k$

      REM no work BAD COMMAND - script works from command line
      REM *RUN /home/pi/software/lcd0.sh
      REM INPUT k$

      REM changes to specified director and creates directory "new" then BAD COMMAND
      OSCLI "cd /home/pi/software"
      OSCLI "mkdir new"
      OSCLI "sh lcd0.sh"

      END
Here is the script that works from the command line but not when called by OSCLI event though another script worked the same both ways. The sudo is just because I was testing copying into the /boot directory from the command line.

Code: Select all

#!/bin/bash
sudo cp /boot/configHDMI.txt /home/pi/software/configbak.txt
echo "lcd0"
I have tried setting permission many different ways and that doesn't seem to have any effect on this problem. Anyone have an example of what works.

Tried on 2 systems CM3+ with stretch version 9 4.19.57-v7 and RPi 3B+ with stretch version 9 4.9.80-v7

As you may gather from the comment on example 4 I am interested in a script to modify /boot/config.txt however I can't get BBCSDL OSCLI to copy anything anywhere so that would be a start.

RichardRussell
Posts: 543
Joined: Tue 15 Oct 2019, 09:10

Re: BBCSDL and OSCLI and cp

Post by RichardRussell »

SteveF wrote:
Thu 08 Aug 2019, 21:30
I know this seems too easy but I can not get the copy "cp" command to work with OSCLI.
Not an answer to your question, but could you perhaps use the built-in OSCLI "copy..." command instead? It doesn't have any of the special options that 'cp' does, but for simply copying a regular file from one place to another it should work.
If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.

SteveF
Posts: 3
Joined: Tue 18 Dec 2018, 20:23

Re: BBCSDL and OSCLI and cp

Post by SteveF »

I should have already posted the solution myself.

It turns out the OSCLI command can do the copy it just needs to be set up a certain way.

Code: Select all

 1074   command$ = "sudo cp /boot/configLCDROT.txt /boot/config.txt"
 1075   OSCLI "RUN " + command$
Setting it up like this seems to make it execute just like you had typed it in from the command line. My problem was solved and I was able to modify the config.txt file for various display options on reboot.