Need help - shc


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help - shc
# 1  
Old 09-06-2011
Need help - shc

I have two scripts test1.sh and test2.sh. test1.sh is calling test2.sh.
test2.sh is having some functions and password which we are using in test1.sh
test1.sh
Code:
#!/bin/sh
. test2.sh
echo "$test"

test2.sh
Code:
#!/bin/sh
test=pravin

O/P
Code:
 pravin

Now use shc to protect my test2.sh and i modified test1.sh code (test2.sh.x which is created from shc -f test2.sh)
Code:
shc -f test2.sh

test1.sh
Code:
#!/bin/sh
. test2.sh.x
echo "$test"

O/P
Code:
./test2.sh.x: line 1:ELF: command not found

Now I am facing above issue. How can I resolved this issue ?
# 2  
Old 09-06-2011
By merging both scripts.
You've generated and executable from test2.sh so it's no more possible to source it in the current environment.
# 3  
Old 09-06-2011
test2.sh.x is an executable file, not shell script anymore. You cannot source (.) it like you cannot source /bin/cat or something else. You can use stdin/stdout to get information from your source shell script or some other techniques like tempfile, named pipes, sockets, etc.
# 4  
Old 09-07-2011
Hi,
Thanks for the replies.
Is there any other way to protect test2.sh as well source to the current script ?
Regards,
Pravin
# 5  
Old 09-07-2011
You may follow the solutions suggested by yazu.
# 6  
Old 09-08-2011
Hi Yazu,
Could you please provide me some guidelines or any documents ?
Thanks
Pravin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue when executing shc command

Hi All, I am trying to create an executable using shc. I have a script which is creating 10 executables. The executables being created have the below issue. The message "Please contact your provider" is displayed even though I am not using the “-e” option. This message is coming for some... (5 Replies)
Discussion started by: temp_user
5 Replies

2. Red Hat

shc utility for background jobs

I have used shc utillity to convert a shell script to it's compiled version.Inside this script i have called another shell script which is also in compled version. Example:- Main script:- main.sh.x child script:- child.sh.x (this is called inside main.sh.x) This child script will run in... (2 Replies)
Discussion started by: millan
2 Replies

3. UNIX for Dummies Questions & Answers

Shc on SUN 5.10 SPARC

Hello, I would like to use shc on SUN 5.10 SPARC and HP UX Itanium 11.31 so that I could do some encrypting on my shell scripts. But on these machines I don"t have cc or gcc. I find a man who can download shc.c and send me the binary files. You can download it here : www datsi fi upm es... (3 Replies)
Discussion started by: peg
3 Replies

4. Shell Programming and Scripting

SHC Cron help-me

Hello, I have some shellscripts internal company more by the need to conceal the code to protect passwords and others, we are using the SHC. the shellscripts always worked without error, including cron. after the SHC, if I run manually (. / shellscript) it works if I put the same command... (3 Replies)
Discussion started by: c0i0t3
3 Replies

5. Shell Programming and Scripting

shc compiler issue

I am using the shc shell compiler, it works fine, just that when i execute it, it displays the code at the terminal. Is there any way to hide this as well? otherwise it beats the purpose of hiding the code. Thanks ! (7 Replies)
Discussion started by: ysvsr1
7 Replies

6. Shell Programming and Scripting

Help with shc

Hi all, I'm trying to install shc on my clean solaris 10 so that I could do some encrypting on my shell scripts. I've tried several ways but it gave me these error messages # make cc -Wall -O6 shc.c -o shc cc: illegal option -Wall *** Error code 1 make: Fatal error: Command failed... (6 Replies)
Discussion started by: solarisnoob
6 Replies

7. Shell Programming and Scripting

Problems using shc

Hi all! First of all, sorry for my poor english :-S Well, I have some scripts in a SuSe server to encrypt... but all them must still working when I encrypt it, ok? About the server, I have root access: # id uid=0(root) gid=0(root) groups=0(root) # uname -a Linux servername... (4 Replies)
Discussion started by: Magius
4 Replies

8. Shell Programming and Scripting

SHC Compiler [ERROR] AIX

Hello there, I’m compiling a shell script under UNIX AIX 5.3 operating system. I’m facing a “glitch” when I tried to run the .x file AIX sent the error message “Killed”. # rpm -qa libgcc-4.2.0-3 libstdc++-4.2.0-3 gcc-4.2.0-3 libstdc++-devel-4.2.0-3 gcc-c++-4.2.0-3 # make *** ... (2 Replies)
Discussion started by: micrinho
2 Replies

9. Programming

How to call the c library created by shc

I have written a shell script called square, which prints the square of the input number, eg. > square 4 16 There is a program called shc which compiles the shell scirpt and create a executable file and a c library file, namely square.x and square.x.c repectively. If I would like to... (1 Reply)
Discussion started by: alfredo
1 Replies

10. Shell Programming and Scripting

shc: shell compiler?

Has anyone ever gotten shc compiler program to work. I am trying to encrypt a bash script on centos. When I run the command "shc -f test.sh", the binary actually gets created; however, when I try to run the binary I get the following the error: # ./test.sh.x ./test.sh.x: No such file or... (1 Reply)
Discussion started by: cstovall
1 Replies
Login or Register to Ask a Question