I have a script:
#! /bin/bash sudo chown -R $USER:$USER /opt/Folder
The chown doesn't seem to execute.
If I just write the above line from terminal ,it runs fine though!
I have read this but doesn't help.
The name of the script is mysetup.sh and I am running as
sudo sh mysetup.sh.
It doesn't give any output.
If I run it like
sudo bash -x mysetup.sh , I am receiving:
sudo chown -R root:root /opt/Folder
This problem does not related to this,since the USER is set.