neurobin / shc

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

running shc with csh #48

Open zuliani71 opened 6 years ago

zuliani71 commented 6 years ago

Hello I've tried shc on my csh scripts. For example my test.csh is here below:

!/bin/csh

echo Hello world

A comment

After a shc -v -U -f test.csh -r I got: shc shll=csh shc [-i]=-c shc [-x]=exec '%s' $argv shc [-l]=-b shc opts= shc: cc test.csh.x.c -o test.csh.x shc: strip test.csh.x shc: chmod ug=rwx,o=rx test.csh.x

but running test.csh.x from the command line produces:

/bin/csh: Event not found. Hello world

: Command not found.

It seems unable to recognize both csh and comments like # Any idea? My shc version is 3.9.6. Bye

neurobin commented 6 years ago

probably your test file is in dos format. Convert it to unix:

dos2unix test.csh

then compile again.

zuliani71 commented 6 years ago

Hi, every script was build inside a Linux environment and the editor is nano. Anyway I've tried your hint and the result is still the same. Below the command sequence: dos2unix test.csh shc -v -f test.csh -r shc shll=csh shc [-i]=-c shc [-x]=exec '%s' $argv shc [-l]=-b shc opts= shc: cc test.csh.x.c -o test.csh.x shc: strip test.csh.x shc: chmod go-r test.csh.x

./test.csh.x /bin/csh: Event not found. Hello world

Again event not found for /bin/csh

neurobin commented 6 years ago

check if your script runs without being compiled. Does /bin/csh exist?

zuliani71 commented 6 years ago

/bin/csh exists and the job runs without problems if started without beeing compiled

byulbee commented 6 years ago

I have the same problem. There is no problem in bash (#!/bin/bash), but in csh (#!/bin/csh) an "Event not found" message is generated. So I am using bash. shc seems to be based on the bourne shell.

weichanghe commented 1 year ago

I have also encountered this issue in csh scripts. because we have a lots of script by csh, Could you help to fix this issue? Thanks