I want to give my long scripts to customer. The customer must not be able to read the scripts even if he has the password. The following command locks and unlocks the script but the set +x
is simply ignored.
The code:
read -p 'Script: ' S &&
C=$S.crypt \
H='eval "$((dd if=$0 bs=1 skip=//|gpg -d) 2>/dev/null)";
exit;' &&
gpg -c<$S | cat >$C <(echo $H | sed s://:$(echo "$H" | wc -c):) - \
<(chmod +x $C)