vendredi 24 septembre 2021

Bash script for user input not working properly

I have the following script:

if [ "$5" = "BLUE" ] ; then
      LIST OF COMMANDS

elif [ "$5" = "GREEN" ] ; then
        $existing_user=$(COMMANDS THAT GENERATE THE OUTPUT)    <------------------ Is this configured properly? 
        if [ "$existing_user" = "$3" ] ; then
                LIST OF COMMANDS
        elif [ "$existing_user" = "" ] ; then  
                LIST OF COMMANDS
        fi
 fi

My script is working, but it skips the if [ "$existing_user" = "$3" ] ; then and goes right to the elif part... When I move $existing_user=$(COMMANDS THAT GENERATE THE OUTPUT), outside of the script it is working fine.

As if I did not configure this variable properly inside the second IF statement?

Aucun commentaire:

Enregistrer un commentaire