Lance_P
Lance_P

Reputation: 399

Executing Perl Scripts Within Variables in Bash

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?

Upvotes: 0

Views: 81

Answers (1)

ysth
ysth

Reputation: 98388

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

# EGG=`perl -e "print 'A'x100"`

Upvotes: 7

Related Questions