I'm having some troubles trying to insert a bash variable inside my perl code. The purpose of the code is to execute a certain perl printing command into a terminal using a bash script file. I have simplified my problem to the code below:
i=5 myvar=$(perl -e 'print "AAA" x ($i)') echo "$myvar"
Having a variable i with 5 as its value, I want to print the string "AAA" as many times as the value of i, which is 5 in this example. To do this I want to use the given perl code. Currently, the perl code cannot read the content from my variable i. This is most likely due to the fact that " " is not being used for the part where I ask the value of i.
Switching the ' and the " is not really a posibility as the String "AAA" will be replaced by hexadecimal codes to be used for shellcode. Using the $ to execute the perl code is required to execute it in the terminal as an argument of a function. And of course, the value of i will increment/change in a loop so I cannot just use 5 instead of i.
Any help to make the perl code able to read the value of i or to work around this problem of the annotations?