in reply to pass perl variable to shell script
Not Perl, but - use command substitution.
#!/bin/sh str="Hello" out=$(perl - $str << 'EOF' $str2 = shift; $str3 = "world"; print "$str2 $str3\n"; EOF ) str3=$(echo $out|cut -d' ' -f2) echo $out echo "In the shell, \$str3 is '$str3'"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: pass perl variable to shell script
by arthurs (Novice) on Aug 11, 2010 at 15:07 UTC | |
by oko1 (Deacon) on Aug 12, 2010 at 15:38 UTC | |
by arthurs (Novice) on Aug 16, 2010 at 19:54 UTC |