QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Fifi on December 16, 2018, 01:34:46 pm

Title: How to get the result of shell commands in QB64 variables on Linux?
Post by: Fifi on December 16, 2018, 01:34:46 pm
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
Title: Re: How to get the result of shell commands in QB64 variables on Linux?
Post by: FellippeHeitor 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.
Title: Re: How to get the result of shell commands in QB64 variables on Linux?
Post by: Fifi 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
Title: Re: How to get the result of shell commands in QB64 variables on Linux?
Post by: FellippeHeitor 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
Title: Re: How to get the result of shell commands in QB64 variables on Linux?
Post by: Fifi 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.