It is currently Sun Jul 05, 2020 7:13 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Linux Help
PostPosted: Wed Jan 07, 2004 4:07 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Apr 30, 2003 3:50 am
Posts: 310
Location: 3DoorsDown
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

_________________
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]


Top
 Profile  
Reply with quote  
 Post subject: Well bizzarely you could just write your own little....
PostPosted: Thu Jan 08, 2004 10:35 am 
Offline
User
User

Joined: Sat Nov 29, 2003 8:49 pm
Posts: 43
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Well bizzarely you could just write your own little....
PostPosted: Thu Jan 08, 2004 4:57 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Apr 30, 2003 3:50 am
Posts: 310
Location: 3DoorsDown
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

_________________
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]


Top
 Profile  
Reply with quote  
 Post subject: this may help you....
PostPosted: Thu Jan 08, 2004 6:10 pm 
Offline
User
User

Joined: Sat Nov 29, 2003 8:49 pm
Posts: 43
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 ...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 09, 2004 12:55 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Apr 30, 2003 3:50 am
Posts: 310
Location: 3DoorsDown
thanks for the chmod calculator link!
I can't get runprogram to do it though...
Code:
;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

_________________
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 09, 2004 1:52 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 12:40 am
Posts: 739
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 09, 2004 2:11 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Apr 30, 2003 3:50 am
Posts: 310
Location: 3DoorsDown
that gives no error, but doesn't change the permissions either.
I'm trying variations without success.
--jb

_________________
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 09, 2004 3:21 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 12:40 am
Posts: 739
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 09, 2004 7:49 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Apr 30, 2003 3:50 am
Posts: 310
Location: 3DoorsDown
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

_________________
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 09, 2004 10:05 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 12:40 am
Posts: 739
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?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 10, 2004 6:22 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 12:40 am
Posts: 739
@TronDoc: solved?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 11, 2004 12:40 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Apr 30, 2003 3:50 am
Posts: 310
Location: 3DoorsDown
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

_________________
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 05, 2004 4:37 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Apr 30, 2003 3:50 am
Posts: 310
Location: 3DoorsDown
anybody figured this out yet?
Joe


Top
 Profile  
Reply with quote  
 Post subject: Re: Linux Help RunProgram("chmod", "777 /tmp/test.sh", ""
PostPosted: Sat Jul 04, 2020 12:50 pm 
Offline
User
User

Joined: Thu Aug 30, 2018 11:34 am
Posts: 31
Works as expected using PB 572 x64 on Ubuntu 18.04 x64

Code:

  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



Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye