Usage of shell variable in perl command

Hi,

I have a shell script, In which i have variable "var1" and some perl command inside shell script.

export var1='coep -n   rst-a2p-hinje.vci.all.com -c'
perl -pi -e 's/^/coep -n   rst-a2p-hinje.vci.all.com -c /'  command.txt

currently I am adding value of var1 in command.txt file by hardcoded.
can I write a perl command which will get the vlaue from variable "var1" and add it to the command.txt file.

Thanks

Try

typeset -x var1='coep -n   rst-a2p-hinje.vci.all.com -c'
perl -pi -e 's/^/$ENV{"var1"} /'  command.txt
1 Like

Thanks Aia :slight_smile: