Lance_P Lance_P - 1 month ago 6
Linux Question

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?


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

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