I am trying to execute the below command.
ssh node1 "nohup sleep 66 &; echo $!"
But I am getting the error:
-bash: !": event not found
I am trying to execute the below command.
ssh node1 "nohup sleep 66 &; echo $!"
But I am getting the error:
-bash: !": event not found
You should use single quotes to prevent interpretation of the $!:
ssh node1 'nohup sleep 66 &; echo $!'
It also looks like the ; isn't useful here. This seems to work:
ssh node1 'nohup sleep 66 & echo $!'