[Linux Tipp] Easiest way to run Bash commands with GP

Advanced GP Tips and Techniques

Moderator: MSandro

Post Reply
Posts: 137
Joined: Jul 26th, '17, 21:12

[Linux Tipp] Easiest way to run Bash commands with GP

Post by MSandro » Jun 4th, '18, 20:23

Hi, because I've needed a better interaction between GP and my OS (Linux), I've tried to find a easy solution to run Bash-Command from GP.

I've wrote the following short script to make this posible:

Code: Select all

while :
  $(head -1 cmd.txt)
  > cmd.txt

This script is able to check the first line of the file "cmd.txt" and execute it. After this it clears the file.

If this script runns in background, you can do e.g. the following in GP:

Code: Select all

self_writeFile 'cmd.txt' 'shutdown now'
GP writes the bash command to the file and the script will execute it.

This is nothing special but I thought; I shuld share it and I will extand this script to output the result of the command to be used in GP. It should be also posible to write a Batch scirpt to do the same on Windows.

Post Reply