Shc : trying to test functionality "test" compiling but can not execute

I am testing shc to see if it would help with my need.

Im at a point where Im trying to compile and test the "test.ksh" file that comes in the tar ball :

shc-3.8.9> shc -v -r -f test.ksh
shc shll=ksh
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: cc  test.ksh.x.c -o test.ksh.x
shc: strip test.ksh.x
shc: chmod go-r test.ksh.x

Execution and the error I am getting :

 /home/popeye/shc-3.8.9> test.ksh.x
test.ksh.x[1]: exec: *15441*test.ksh.x: not found

shc version shc-3.8.9

on a box with:

Linux 2.6.32-358.2.1.el6.x86_64  Wed Mar 13 00:26:49 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Code that I'm trying to compile (also part of the tar ball) :

#! /bin/ksh -x
echo "\$@ is $@"
echo "command line: $0 $*"
echo "hello world"
# Added
echo "[$$] PAUSED... Hit return!"
read DUMMY
exit 0

Thanks very much in advance for any help you can provide.

try:

./test.ksh.x

I have the same issue with similar error as below...

$ ./tSch_Csc.sh.x
./tSch_Csc.sh.x: /home/MAIN/REP/*64241*./tSch_Csc.sh.x: No such file or directory
./tSch_Csc.sh.x: line 0: exec: /home/MAIN/REP/*64241*./tSch_Csc.sh.x: cannot execute: No such file or directory

can someone please advise where this is going wrong...

I have also tried to compile the ".c " file manually as below which shc generated. but no luck...

gcc tSch_Csc.sh.x.c -o tSch_Csc.sh.x

Works for me on my Slackware 14.1 box. Maybe try using strace to see if anything is missing:

strace -o output shc -v -r -f test.ksh

On my box:

shc -v -r -f testscript.ksh
shc shll=ksh
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: cc  testscript.ksh.x.c -o testscript.ksh.x
shc: strip testscript.ksh.x
shc: chmod go-r testscript.ksh.x

file testscript.ksh.x
testscript.ksh.x: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped

./testscript.ksh.x
I'm compiled!

Try

shc -v -r -T -f script.sh 

Thanks for your replies..

I did use below to create...

shc -v -r -T -f script.sh

The issue is that, it works fine on "Machine A" which is as below

uname -a
Linux Machine A 2.6.32-279.2.1.el6.x86_64 #1 SMP Thu Jul 5 21:08:58 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

But when i move this script to "Machine B" which seem to be similar to A as below..

uname -a
Linux Machine B 2.6.32-279.2.1.el6.x86_64 #1 SMP Thu Jul 5 21:08:58 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

Then, it throws these errors..

./tSch_Csc.sh.x
./tSch_Csc.sh.x: /home/MAIN/REP/*64241*./tSch_Csc.sh.x: No such file or directory
./tSch_Csc.sh.x: line 0: exec: /home/MAIN/REP/*64241*./tSch_Csc.sh.x: cannot execute: No such file or directory

I did try to copy the ".c" file to Machine B and compiled it and generated the script as below... but still no luck...

gcc tSch_Csc.sh.x.c -o tSch_Csc.sh.x

what could be missing.... or what else could i check for ...

/home/MAIN/REP/*64241*

what is that?

If your folder really does have *'s in it, any use of the folder name unquoted will try and expand these *'s into other filenames. So it could be a bug in the script rather than shc.

I'm not sure where *64241* is coming from. My folders does'nt really have any thing like that neither my code..

For this i just created a sample script to test..

cat test1.sh
#!/bin/bash
         COUNTER=20
         until [  $COUNTER -lt 10 ]; do
             echo COUNTER $COUNTER
             let COUNTER-=1
         done

Then,....

shc -v -r -T -f test1.sh

Then i run the test1.sh.x as below.. which runs fine on "Machine A"

./test1.sh.x
COUNTER 20
COUNTER 19
COUNTER 18
COUNTER 17
COUNTER 16
COUNTER 15
COUNTER 14
COUNTER 13
COUNTER 12
COUNTER 11
COUNTER 10

Now, I move test1.sh.x to "Machine B" and execute test1.sh.x as below.. and it throws me these errors...

./test1.sh.x
./test1.sh.x: /home/*64241*./test1.sh.x: No such file or directory
./test1.sh.x: line 0: exec: /home/*64241*./test1.sh.x: cannot execute: No such file or directory

---------- Post updated 11-07-13 at 03:31 PM ---------- Previous update was 11-06-13 at 05:37 PM ----------

Thanks for your replies again.

The issue is resolved now..Looks like the issue was with my shell bash (Machine A) vs ksh (Machine B)

On Machine A, where the original .sh was compiled using shc

echo $SHELL
/bin/bash

On Machine B, where it was throwing errors....

echo $SHELL
/bin/ksh

Changed it to bash as ..

bash

Now it works fine.. :slight_smile:

Thanks again for your replies..