I want to run the following script
#!/bin/sh
temp =`date +%Y%m%d`
echo "$temp"
But this not running as expected it is throwing this error message temp: execute permission denied
You have
temp =`date +%Y%m%d`
^
So you need to remove the space between temp
and date
:
#!/bin/sh
temp=$(date +%Y%m%d) # better than `exp`, thanks @OliverDulac (see comments)
echo "$temp"
With this it works to me.
Make sure the file has execution permissions:
chmod +x your_file
or just execute it with
/bin/sh /your/script/path/your_file
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