Sowjanya lankisetty Sowjanya lankisetty - 4 months ago 12
Bash Question

unable to run shell script compiler binary which having dependency internally with another shell script

I have two shell scripts which have dependencies. Using

shc
compiler i created two binaries. But while running one binary, it is unable to resolve dependent binary. I am seeing below error:

line 1 : ???? :command not found


How to deal with shell scripts which have dependencies.

#!/bin/bash

get_network_status()
{
network_status=`ifconfig`
if [ $network_status -eq 0 ]; then
echo $network_status
else
echo "1"
fi
} is shell script used by below shell script

#!/bin/bash

source first_shellscript.sh
get_network_status;

Answer

shc is not exactly a compiler but it rather encrypts and places the script within a C file.

It is not possible to use multiple scripts and source to work within a script that has to be "compiled" by shc. Only way out is to put everything in a single script.

Please read this reference post