I want to use the line below to change a password. When I put actual values instead of variables, the command works perfectly.
echo -e "$sshpass\n$sshpass | (passwd --stdin root)"
$sshpass is a variable containing a password.
I tried the following to make commands work with no luck:
echo -e "/$sshpass\n/$sshpass | (passwd --stdin root)"
echo -e "$sshpass\n$sshpass | (passwd --stdin root)"
echo -e "'$sshpass'\n/'$sshpass' | (passwd --stdin root)"
How can I make it work?
echo -e "xyz\nxyz | (passwd --stdin root)"? It shouldn't change the password.