neurobin / shc

Shell script compiler

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to use export when run through shc script

dl-srikanth opened this issue · comments

I have a script in bash where I export some variables so that I can use them in another shell script. Now when I use shc and convert into executable script and I run it I am not able to source those variables.

For ex: say I have a script
test.sh
#!/bin/bash
owner=tcmp
export tcmp

I run this in bash as
./test.sh

and when I do

echo $owner

it displays tcmp

Now I convert test.sh using shc compiler and I get test.sh.x script

when I run this script
./test.sh.x
and then try to do echo $owner it gives me empty output. Can you please assist how to achieve this when I use shc compiler.

you can not achieve this unfortunately...the binary file runs the script in a subshell.