diff --git a/cmake_targets/autotests/run_exec_autotests.bash b/cmake_targets/autotests/run_exec_autotests.bash
index 4608c58e9b1aba18e2d43d053b2eaa9768915b3b..a98a071bae39a3e1d539e2f5897dd7eb4a36fefc 100755
--- a/cmake_targets/autotests/run_exec_autotests.bash
+++ b/cmake_targets/autotests/run_exec_autotests.bash
@@ -404,14 +404,12 @@ until [ -z "$1" ]
    esac
   done
 
-if [ "$SET_PASSWORD" == "1" ]; then
-   mypassword=$passwd
-else
-   read -s -p "Enter Password: " mypassword
+if [ "$SET_PASSWORD" != "1" ]; then
+   read -s -p "Enter Password: " passwd
 fi
 
 tmpfile=`mktemp`
-echo \'$passwd\' | $SUDO echo $HOME >& $tmpfile
+echo $passwd | $SUDO echo $HOME > $tmpfile
 tstsudo=`cat $tmpfile`
 if [ "$tstsudo" != "$HOME" ]; then
   echo "$USER might not have sudo privileges. Exiting"