![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can we pass an array of strings from a Perl Program to a Shell Script? | som.nitk | Shell Programming and Scripting | 0 | 08-23-2009 02:22 PM |
| pass variables from one script to another | vasuarjula | Shell Programming and Scripting | 3 | 12-12-2008 03:09 AM |
| Need help passing variables in shell script to perl one-liner | Xek | Shell Programming and Scripting | 1 | 01-15-2008 03:12 PM |
| How to pass Shell variables to sqlplus use them as parameters | Jtrinh | Shell Programming and Scripting | 1 | 07-13-2005 04:15 AM |
| Pass multiple variables to SQL script | jagannatha | Shell Programming and Scripting | 1 | 10-25-2002 09:45 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
pass perl variables to shell script
I have a perl script that opens a text file containing numbers on each line:
for example: 755993 755994 755995 755996 755997 755998 The perl script takes these numbers and store them as an array @raw_data, where I can access individual numbers by using $raw_data[0] for the value 755993. What I want is to pass the variable $raw_data[0] and the following numbers ($raw_data[1] ... $raw_data[77]) one by one into a shell script (bash) where I can store them as the variable ID_NUMBER (for example) and be able to use the value in my shell script. In case, I wasn't clear, I want to pass $raw_data[0] into my shell script, save it as the variable ID_NUMBER, run the rest of the shell script, then pass $raw_data[1] into the script and do the same thing as before. I'm hoping someone can provide a solution to this problem. I've tried using the system() command in perl and possibly I'm doing it wrong, but it hasn't worked out for me. Thanks in advance! |
|
||||
|
you could execute your perl script from a shell script to capture the perl script output like this:
Code:
#!/bin/sh for each in list do ID_NUMBER=`perl myscript.pl` # do more stuff done Code:
#!/bin/perl
for ... {
...
$ENV{ID_NUMBER}=$myval;
system("do_something_with_ID_NUMBER.sh");
}
|
|
||||
|
Thank you! I'll give that a shot.
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| bash, perl, shell, variable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|