0

Following my professors exact instructions, I am trying to create a variable named EGG that contains 100 'A's by running this command from my Kali VM:

root@kali:~# EGG='perl -e "print 'A'x100"'

This is my result when attempting to echo the variable:

root@kali:~# echo $EGG
perl -e "print Ax100"

In my professor's demonstration, his variable contained 100 'A's as is expected. Any suggestions on how to fix this?

1

1 Answer 1

7

You need to use back ticks in the shell to capture a command's output.

# EGG=`perl -e "print 'A'x100"`
Sign up to request clarification or add additional context in comments.

2 Comments

Oh, thank you so much. I was mistaking them for apostrophes on the replay of my professor's lecture.
This is one of the reasons that $( ) (e.g. EGG=$(perl -e "print 'A'x100")) is preferred over backquotes -- it's much harder to misread.

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.