AyooshJ
asked on
calling perl varibles in a shell script
Hi
How can we call perl variables in a shell script? Can somebody give an example?
Thanks
How can we call perl variables in a shell script? Can somebody give an example?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
by "call" do you mean
name, or say, or invoke, or command, or signal, or predict, or summon, or designate, or need, or postpone, announce, or ... ?
which perl variables do you want to call? in what perl program?
is the shell process a parent of the perl process?
is the perl process a parent of the shell process?
Do they run on the same machine?
Do they run at the same time?
Are you writing a perl script that needs to work with an existing shell script?
are you writing a shell script that needs to work with an existing perl scipt?
what would these shell and perl scripts do?
name, or say, or invoke, or command, or signal, or predict, or summon, or designate, or need, or postpone, announce, or ... ?
which perl variables do you want to call? in what perl program?
is the shell process a parent of the perl process?
is the perl process a parent of the shell process?
Do they run on the same machine?
Do they run at the same time?
Are you writing a perl script that needs to work with an existing shell script?
are you writing a shell script that needs to work with an existing perl scipt?
what would these shell and perl scripts do?
#!/bin/sh
echo "This is a basic bash shell script"
echo ""
echo "This is a Perl string within the bash script:"
echo ""
perl -e 'for(1..10) {print "$_\n";}'
echo "This is a basic bash shell script"
echo ""
echo "This is a Perl string within the bash script:"
echo ""
perl -e 'for(1..10) {print "$_\n";}'
Here are two examples:
Example 1
#!/usr/bin/perl
$ENV{foo}='bar';
system "/path/to/script.sh";
#!/bin/sh
echo $foo
Example 2
#!/usr/bin/perl
system "/path/to/script.sh bar"
#!/bin/sh
echo "$1"