I have a scenario where I have to switch to the different user and after that, I need to execute the some Linux command.
my command is something like this
( echo myPassword | sudo -S su hduser ) && bash /usr/local/hadoop/sbin/start-dfs.sh
but with this command, I switch to the user and the next command got triggered on the previous user.
Is there any I can accomplish this using shell script