Author Topic: How to get the result of shell commands in QB64 variables on Linux?  (Read 3022 times)

0 Members and 1 Guest are viewing this topic.

Offline Fifi

  • Forum Regular
  • Posts: 181
    • View Profile
    • My small QB64 contribution
Hi all,

These are just small exemples:

On Linux, the command "uname -r" returns the version of the kernel and the command "lsb_release -sc" returns the name of the distribution.

What should I do to get these responses in QB64 variables (please provide a sample of code)?

TIA
Fifi
It's better to look like an idiot for a short time while asking something obvious to an expert than pretending to be smart all your life. (C) Me.

FellippeHeitor

  • Guest
Re: How to get the result of shell commands in QB64 variables on Linux?
« Reply #1 on: December 16, 2018, 01:55:09 pm »
You should be able to redirect the output of the SHELL call to a file (adding > filename) and then use OPEN to read it back.
« Last Edit: December 16, 2018, 01:59:53 pm by FellippeHeitor »

Offline Fifi

  • Forum Regular
  • Posts: 181
    • View Profile
    • My small QB64 contribution
Re: How to get the result of shell commands in QB64 variables on Linux?
« Reply #2 on: December 16, 2018, 04:15:43 pm »
Hi Fellippe,

You should be able to redirect the output of the SHELL call to a file (adding > filename) and then use OPEN to read it back.

Thanx for this tip. That should do the job.

However, I was hopping for an internal command, but I may dream.

Thanx again.
Fifi
It's better to look like an idiot for a short time while asking something obvious to an expert than pretending to be smart all your life. (C) Me.

FellippeHeitor

  • Guest
Re: How to get the result of shell commands in QB64 variables on Linux?
« Reply #3 on: December 16, 2018, 05:01:07 pm »
I know most users are not used to checking the code repository on github, so let me tell you that it has already been considered for a future version to streamline the process of reading the output of a shell call: https://github.com/Galleondragon/qb64/issues/73

Offline Fifi

  • Forum Regular
  • Posts: 181
    • View Profile
    • My small QB64 contribution
Re: How to get the result of shell commands in QB64 variables on Linux?
« Reply #4 on: December 16, 2018, 06:07:09 pm »
I know most users are not used to checking the code repository on github, so let me tell you that it has already been considered for a future version to streamline the process of reading the output of a shell call: https://github.com/Galleondragon/qb64/issues/73

I use your own words: This will be revolutionary.
It's better to look like an idiot for a short time while asking something obvious to an expert than pretending to be smart all your life. (C) Me.