hi all,
I need to 1.switch to a particular user. 2. go to particular folder. 3. check status of an application. in just one go, for which I have added all the commands in the following format in a file and then executed that file like this ./file but I can see only the first 1.switch to particular user was successfull and didnt see other 2 commands getting executed.
contents of my file :
sudo su - jack \
&& cd \opt\jae \
&& ./appctl status
I also tried
sudo su - jack && cd \opt\jae\ && ./appctl status ..
Both executes only the first command and stops. Can someone please help.
I need to 1.switch to a particular user. 2. go to particular folder. 3. check status of an application. in just one go, for which I have added all the commands in the following format in a file and then executed that file like this ./file but I can see only the first 1.switch to particular user was successfull and didnt see other 2 commands getting executed.
contents of my file :
sudo su - jack \
&& cd \opt\jae \
&& ./appctl status
I also tried
sudo su - jack && cd \opt\jae\ && ./appctl status ..
Both executes only the first command and stops. Can someone please help.