The value of a variable is lost

0

I have a problem with a variable that I want to keep, but I suppose that by the memory reference that Bash does, he crushes me anyway.

I have a function that I call with 3 parameters:

MiFuncion "Correo sin leer" "[email protected]" "Este es el Asunto"

(this last parameter can be an encoded string, like this: "=? utf-8? B? dfICfer43p42rf324orF?=")

function MiFuncion() {
 ASUNTO="$3"
 echo "$3" | grep -q '\=\?utf-8\?B'
 if [ $? -ne 0 ]; then
   vSubject2='grep -oP '(?<=B\?).*?(?=\?)' <<< "$3"'
   ASUNTO='echo "$vSubject2" | base64 --decode'
 fi
echo $2
echo $ASUNTO
}

But $ SUBJECT comes out empty when it is not coded, that is, the IF is not fulfilled. Any suggestions?

Thank you, best regards

    
asked by Bypper 05.01.2019 в 14:11
source

1 answer

0

Nothing, my fault. The problem is the IF and the condition that I had put, that I had to check that it was equal to 0 and not different.

    
answered by 05.01.2019 в 16:34