neurobin / shc

Shell script compiler

Home Page:https://neurobin.org/projects/softwares/unix/shc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BASH execute binary file and read/modify variables

conandrum opened this issue · comments

I used to do this:

declare -g var='value'
. ~script.sh sub

and my var was available to read and modify from within my sub.

Now I have a binary instead of script.sh and I want the same functionality. Of course, now I cannot do

. ~/script.bin sub

because bash 'cannot execute binary file'

Instead I have to :

declare -g var='value'
~/script.bin sub

How do I get ~/script.bin sub to read/modify my var?

I tried also: declare -gax var='value' and export var='value' but no cookie.

eventually I used shared memory /dev/shm to share variables