close
shc, a generic script compiler
可以把 Shell Script 原始檔編譯,以免原始碼外洩。
先從 http://www.datsi.fi.upm.es/~frosal/ 下載 shc-3.8.9.tgz。
# tar -zxvf shc-3.8.9.tgz --解壓縮
# cd shc-3.8.9
# make
make: *** No rule to make target `shc.c', needed by `shc'. Stop. --失敗,提示沒有 shc.c
# less makefile --查看 makefile 描述檔
INSTALL_PATH = /usr/local --安裝目錄,最後它會安裝在 /usr/local/bin/
shc: shc.c
$(CC) $(CFLAGS) $@.c -o $@ --需要 shc.c
# cp shc-3.8.9 .c shc.c --複製檔案
# make
# make install
安裝成功後,撰寫一個測試 Shell Script
# vi test.sh
只有兩行內容,顯示 Hello,the world
#!/bin/sh
echo "Hello, the world"
# chmod 700 test.sh
# shc -v -f test.sh
產生兩個檔案 test.sh.x.c 與 test.sh.x
# ./test.sh.x
Hello, the world
測試成功
全站熱搜
留言列表