Pass variable from perl script to shell script in Unix -


am pretty aware of passing variables between shell scripts using 'export' command. stuck passing variable value perl script shell script in unix operating systems.

let me explain clearly.

i have parent shell called parent_shell.sh. inside shell script using variable called 'file_name' should fetch child perl script.

so inside parent_shell.sh script follows,

perl my_perl_script.pl  file_name = 'variable' #from perl above perl script 

hope clear. please let me know if not clear.

thanks

modifying global %env hash in perl equivalent exporting variables in shell.

however, exporting variables in environment, in language, only affects child processes, period. can't modify parent process environment in way.

the child script can return printing on standard output , standard error , it's status, number 0-127 (well, it's number 0-255, shell can reliably process values 127).

if need 1 value perl script, print value , use process substitution shell:

file_name=$(perl my_perl_script.pl) 

if more, can print shell code set variables , use shell's eval, make sure quote values correctly before printing perl.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -