I' m writing an expect script that is inside of a bash script and reads it's input from stdin, so I can define variables in the bash script that can be used in the expect script. But my problem is on the line
send "sudo useradd -c '$NAME' -s /bin/sh -p '$PASS' $USERNAME \r"
It returns an error because the $PASS variable contains an encrypted password,
which contains $'s which is reserved for expect variables, how can i quote this without receiving errors?
when this code is executed the command that runs actually looks like so
sudo useradd -c 'Tim Cook' -s /bin/sh -p '$2aHgs57dfdHdfsG3v' tim