I have a cron job environment variable which I wanna export.
export CRON="30 * * * * *"
The problem is * (asterisk) brings all file name in that folder. Which end up with an error. For a quick try and understand the issue do followings.
export TEST="30 *"echo $TESTHere Output will not
30 *
It's
30
and all your files in that folder.
PS:- This environment variable is getting read by one application and needs to use this in some function. ex :-
cron.schedule(CRON, function(){// some code handling})
Your export command is okay and does not cause the asterisks to be expanded. The problem is your echo $TEST. The rules for POSIX shells cause the expansion of $TEST to occur before glob expansion. So what you are doing is actually this:
echo 30 *
If you quote the expansion to inhibit the glob expansion you will see what you expect:
echo "$TEST"
Your question is a good example why the POSIX 1003 shell behavior is awful. And so many new, innovative, shells like fish and elvish don't implement that behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With