0

I'm trying to decode my password through a script while it's being run but it seems like the script is being run with a literal and the password is not processed. Is there a better way of doing this?

#!/bin/bash
MYENC="Tk9UX1RIQVRfU1RVUElEX0xPTAo="

rdesktop -u FOO -d mgmt -p 'echo $(echo $MYENC) | base64 --decode' 192.0.0.0

I also tried to just pass in a variable but that failed as well.

2 Answers 2

1

Try this instead:

#!/bin/bash
MYENC="Tk9UX1RIQVRfU1RVUElEX0xPTAo="

rdesktop -u FOO -d mgmt -p $(echo $MYENC | base64 --decode) 192.0.0.0

Note that I wrapped the juicy stuff echo...base64... in $(...). This is called "command substitution" - basically you're telling bash that you want the code inside the $(...) to be executed before the rest of the line, with the result substituted in its place. More info here: http://www.tldp.org/LDP/abs/html/commandsub.html

Sign up to request clarification or add additional context in comments.

1 Comment

Recommend the use of $(…) in place of back quotes.
0

Or this

#!/bin/bash
MYENC="Tk9UX1RIQVRfU1RVUElEX0xPTAo="
rdesktop -u FOO -d mgmt -p $(base64 --decode <<< "$MYENC") 192.0.0.0

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.