Closed lightaffaire closed 1 week ago
Someone suggested before, but I think it's trival to do it in your script.
Thanks for your reply but its not quite that simple.
In some cases yes that would be possible but the majority of our code is submitted to us from various department for checking, testing and converting to binaries. In those cases we have zero chance of convincing department heads that they should be reponsible for adding a new block of code that has been added by shc for years.
Any scripts that leave our companies division do so only as binaries with an expire date and contact info to receive the newest version or renew support etc.
So it would be a useful addition to ssc. Hope you can make it happen.
Iain
Added -d
and -m
flags. Try it.
seems to have a strange behaviour
$ ./ssc -d 04/09/2024 -m 'as expired' -u -0 /tmp/test.sh /tmp/test1.sh
$ /tmp/test1.sh
test
$ /tmp/test1.sh
test
$ /tmp/test1.sh
test
$ /tmp/test1.sh
test
$ /tmp/test1.sh
test
$ /tmp/test1.sh
test
$ /tmp/test1.sh
test
$ /tmp/test1.sh
test
$ /tmp/test1.sh
test
$ rm /tmp/test1.sh
$ ./ssc -d 04/09/2024 -m 'as expired' /tmp/test.sh /tmp/test1.sh
$ /tmp/test1.sh
as expired
$ /tmp/test1.sh
test
$ /tmp/test1.sh
as expired
$ /tmp/test1.sh
as expired
$ /tmp/test1.sh
test
$ /tmp/test1.sh
as expired
$ /tmp/test1.sh
as expired
$ /tmp/test1.sh
test
$
can't reproduce.
# root @ DESKTOP-PD5C844 in /mnt/c/Users/liberize/Desktop/ssc [22:01:37]
$ ./ssc -d 04/09/2024 -m 'as expired' -u -0 test.sh test1.sh
# root @ DESKTOP-PD5C844 in /mnt/c/Users/liberize/Desktop/ssc [22:01:41]
$ ./test1.sh
as expired
# root @ DESKTOP-PD5C844 in /mnt/c/Users/liberize/Desktop/ssc [22:01:44] C:1
$ ./test1.sh
as expired
# root @ DESKTOP-PD5C844 in /mnt/c/Users/liberize/Desktop/ssc [22:01:45] C:1
$ ./test1.sh
as expired
# root @ DESKTOP-PD5C844 in /mnt/c/Users/liberize/Desktop/ssc [22:01:45] C:1
$ ./test1.sh
as expired
# root @ DESKTOP-PD5C844 in /mnt/c/Users/liberize/Desktop/ssc [22:01:46] C:1
$ ./test1.sh
as expired
# root @ DESKTOP-PD5C844 in /mnt/c/Users/liberize/Desktop/ssc [22:01:46] C:1
$ ./test1.sh
as expired
# root @ DESKTOP-PD5C844 in /mnt/c/Users/liberize/Desktop/ssc [22:01:47] C:1
$ ./test1.sh
as expired
# root @ DESKTOP-PD5C844 in /mnt/c/Users/liberize/Desktop/ssc [22:01:47] C:1
$ ./test1.sh
as expired
Thanks for adding this. I took a look at the feature this morning and it acted strangely and would not generate a binary.
The problem seems to be if --expire-message has more than 1 word. If >1 word the eval statement on line 22 of ssc seems to have a problem. I ended up creating a short harness script that shows the problem.
Script: harness.sh
SSC="/usr/local/src/ssc-master/ssc" SSCopt= #"-v" Script="/tmp/db" Binary="/tmp/db.bin" #
ExpireOpt="--expire-date 06/09/2024 --expire-message 'ONEWORD TWOWORD'"
$SSC $SSCopt $ExpireOpt $Script $Binary
exit 0
The eval on line 22 shouldn't be a problem because the exipre message has been parsed on line 14. Maybe it has something to do with your environment. Again, I cannot reproduce it.
root /mnt/c/Users/liber/Desktop/ssc
$ ./ssc test2.sh test -d 09/05/2024 -m 'with space'
root /mnt/c/Users/liber/Desktop/ssc
$ ./test
with space
root /mnt/c/Users/liber/Desktop/ssc
$ ./ssc test2.sh test -d 09/05/2024 -m 'multi
quote then else> line'
root /mnt/c/Users/liber/Desktop/ssc
$ ./test
multi
line
root /mnt/c/Users/liber/Desktop/ssc
$ echo 'message' >message.txt
root /mnt/c/Users/liber/Desktop/ssc
$ ./ssc test2.sh test -d 09/05/2024 -m message.txt
root /mnt/c/Users/liber/Desktop/ssc
$ ./test
message
root /mnt/c/Users/liber/Desktop/ssc
$
please try the short bash script above
It's a shell evaluation issue. See this:
https://unix.stackexchange.com/questions/38440/why-does-bash-variable-expansion-retain-quotes
So the fix is:
eval $SSC $SSCopt $ExpireOpt $Script $Binary
Ok the eval form you mentioned worked. Thank you.
Tested with latest version. The -d and -m options work for me.
Issue can be closed.
Was interested to see another script to binary tool.
Been using shc for numerous bash scripts for a while and we always use -e --expire-date so that older versions of our work do not come back to haunt use.
Any chance of adding shc's -e expire-date and -m expire-message functionality ?
Maybe even a -M long-multiline-expire-message as well.
Thanks
Iain