neurobin / shc

Shell script compiler
https://neurobin.org/projects/softwares/unix/shc/
GNU General Public License v3.0
2.02k stars 345 forks source link

how to use for bash environment #105

Closed SummerSeaSun closed 4 years ago

SummerSeaSun commented 4 years ago

Dear Sirs, I've compiled a bash script which should make available a set of function system wide on a Raspbian. With original script .sh it runs fine, with the compiled version it won't work.

setoffunction.sh


#!/bin/bash
function myfunction {
      echo "$1"
}

compiled with: shc -f /opt/setoffunction.sh

added to be loaded at boot: cat /etc/environment:

BASH_ENV=/opt/setoffunction.sh.x

Linux test 4.14.71-v7+ #10 SMP Mon Feb 10 05:36:31 UTC 2020 armv7l GNU/Linux

neurobin commented 4 years ago

It will never work. The script runs in an isolated subshell.