I have to connect to a different cli and execute few commands and exit. sudo $SIGNMCLI connects to a cli. The below script doesn't work. I want to execute the exit in SIGNMCLI.
#!/bin/bash -xv
SIGNMCLI=/opt/sign/EABss7024/bin/signmcli
if [ -f "$FileCheck" ];
then
sudo $SIGNMCLI
exit;
fi
If I do the following, it works:
#!/bin/bash -xv
SIGNMCLI=/opt/sign/EABss7024/bin/signmcli
if [ -f "$FileCheck" ];
then
echo 'exit' |sudo $SIGNMCLI
fi
But, I want to execute multiple commands in SIGNMCLI. Is there anyway to redirect the control to SIGNMCLI and after executing all the commands, the control comes back?