In: Computer Science
A shell script foo contains the statement echo “$PATH $x”. Now define x=5 at the prompt, and then run the script. Explain your observations and how you can rectify the behavior.
On executing the script, we will get permission denied error.
To, overcome that error, we use chmod +x foo.sh
Please see the below image for step by step solution.