Reputation: 249
#!/bin/bash
export IPV6=$1
expanded_ipv6_addr=`perl -e 'require "/usr/bin/ipv6_helper.pm"; $expand_ipv6=expand_ipv6_addr($ENV{IPV6});print $expand_ipv6'`
I don't want to export the $IPV6
variable, so I am looking any other way to do this.
Upvotes: 0
Views: 111
Reputation: 1
Instead of exporting $1 into an environment variable you could use it again later and escape the perl code.
The following worked for me with a stubbed out version of /usr/bin/ipv6_helper.pm
#!/bin/bash
IPV6=$1
expanded_ipv6_addri=`perl -e "
require \"/usr/bin/ipv6_helper.pm\";
\\$expand_ipv6 = expand_ipv6_addr($IPV6);
print \\$expand_ipv6
"`
Upvotes: -1
Reputation: 246807
Grab the value from @ARGV:
expanded_ipv6_addr=$(
perl -e '
require "/usr/bin/ipv6_helper.pm";
print expand_ipv6_addr(shift)
' "$IPV6"
)
Upvotes: 2