This is my command.sh [After entering the command nothing happened][2]I want to automate the commands in putty so i have written the commands in a shell script and called it from a batch file
echo -e "password" | sudo -S screen -ls
pwd
cd ..
these are the commands in shell script, but the commands pwd
, cd
are not executing after sudo
commands..... No commands are working under sudo
commands
That happens because you launch screen and the process never exits so the bash script cannot move forward to the pwd
and cd
commands
As a workaround you may write down your commands into the shell script and execute it in screen using
screen -d -m bash ./script.sh
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.