Page 1 of 1

Linux Help

Posted: Wed Jan 07, 2004 4:07 pm
by TronDoc
It would be nice if any Linux Gurus pass through
and post a tip or two here..
..I'm not a Guru, but I've found a couple of things
with trying to use PureBASIC under Linux.

you have to manually set permissions before
you can execute a binary you've created.
(any Guru with a script that will compile, chmod, etc?)

you can "run" code directly by: pbcompiler filename.pb

you can "run" your compiled binary using: ./filename.bin

Joe

Well bizzarely you could just write your own little....

Posted: Thu Jan 08, 2004 10:35 am
by Iria
Why not code a simple PB console app for linux that does what you want...

Just shell out the commands to CHMOD 766 xxxx.exe, rename the executable to a linux std, i.e. no extension. Even move it to a debug/test directory. Shouldnt be that hard?

Regards

Andy

Re: Well bizzarely you could just write your own little....

Posted: Thu Jan 08, 2004 4:57 pm
by TronDoc
Iria wrote:Why not code a simple PB console app for linux that does what you want...
duh :oops: never thought of that.
thanks for the chmod value.. ..that I didn't know what to set as.
Joe

this may help you....

Posted: Thu Jan 08, 2004 6:10 pm
by Iria
Chmod is a little more involved but for simple high level permission setting I found this little site...

http://javascriptkit.com/script/script2/chmodcal.shtml

which simply lets you work out in a nice human readable form what permission values to use to get different results.

hope that helps ...

Posted: Fri Jan 09, 2004 12:55 pm
by TronDoc
thanks for the chmod calculator link!
I can't get runprogram to do it though...

Code: Select all

;RunProgram(FileName$ [, Parameter$, WorkingDirectory$ [, Flags]])
FileName$ = "chmod" : Parameter$ = "744 testfile" : WorkingDirectory$ = ""
RunProgram(FileName$ , Parameter$, WorkingDirectory$)

;RunProgram("chmod","744 testfile","") :;chmod complains "too few arguments"
;RunProgram("chmod"," 744 testfile","") :;chmod complains "too few arguments"
;RunProgram("chmod","744","./testfile") :;chmod complains "too few arguments"
;RunProgram("chmod","744 testfile","") :;chmod complains "too few arguments"
;RunProgram("chmod","744 testfile","./") :;chmod complains "too few arguments"
;RunProgram("chmod","-c 744 testfile","") :;chmod complains "invalid option"
;RunProgram("chmod","-c744 testfile","") :;chmod complains "too few arguments"
;RunProgram("chmod","--help","")  :;this works!
End
:roll:
--jb

Posted: Fri Jan 09, 2004 1:52 pm
by dmoc
Just a thought, try RunProgram("chmod 744 ./testfile", "", "") maybe varying the path. I would try it myself but I debugging on a dual boot box.

Posted: Fri Jan 09, 2004 2:11 pm
by TronDoc
that gives no error, but doesn't change the permissions either.
I'm trying variations without success.
--jb

Posted: Fri Jan 09, 2004 3:21 pm
by dmoc
As root or restricted user? What is the pb programs permissions? Have you checked the log (tail /var/log/messages), not sure if/where an attempt to chmod without permissions would be reported. Keep the info coming though, I have solve my problem and can boot up Linux if it helps.

Posted: Fri Jan 09, 2004 7:49 pm
by TronDoc
O.K.
root can't do it either, but that doesn't seem to be the problem.
it seems to be the passing of parameters in general, not just to chmod.
I've also discovered something weird about the Linux I am using:
from the terminal window the permissions show
a binary created by PureBASIC as executable, and it IS!
BUT using the Nautilus "Graphic Shell" (file browser) the same
file's permissions show NOT executable.
It's as if the O.S. is keeping two separate permissions lists.
One for the terminal mode and one for the GUI mode.!?

None of that explains why I can't properly pass parameters.
Can anyone give an example of code successfully passing
parameters from one Linux executable to another?

Joe

Posted: Fri Jan 09, 2004 10:05 pm
by dmoc
First, I would trust the terminal over Nautilus.

The best I can get is chmod actual running by supplying "/bin/chmod" (seperately) but it reports "too few arguments". I have tried a variety of paths but it would appear PB not passing the argument. Also tried as root but same result. Fred?

Posted: Sat Jan 10, 2004 6:22 pm
by dmoc
@TronDoc: solved?

Posted: Sun Jan 11, 2004 12:40 am
by TronDoc
nope. :(
I got distracted and wrote a chmodCALCulator :oops:
I hope to morph that into a chmodGUI, but still can't
get the progargs to process like they should :roll:
Joe

Posted: Fri Mar 05, 2004 4:37 pm
by TronDoc
anybody figured this out yet?
Joe

Re: Linux Help RunProgram("chmod", "777 /tmp/test.sh", ""

Posted: Sat Jul 04, 2020 12:50 pm
by BlindMan
Works as expected using PB 572 x64 on Ubuntu 18.04 x64

Code: Select all


  If CreateFile(0, "/tmp/test.sh")
    WriteStringN(0, "#!/bin/bash")
    WriteStringN(0, "ls -lA > /tmp/test.txt")
    CloseFile(0)
  Else
    MessageRequester("Error", "Unable to create script")
  EndIf

  RunProgram("chmod", "777 /tmp/test.sh", "")
  Delay(1000)
  RunProgram("/tmp/test.sh")
  
  End