Solved

How to get the echo command via perl?

Posted on 2002-04-25
2
222 Views
Last Modified: 2010-03-05
I need to know how to do these built-in unix commands line and put it in a perl script-

setshot cuetest/wrappers
   shot
   cd wrappers_cmp_v3/
   ls
   cd 2kfa_lg8/
   netscape -remote "openUrl(http://vfo-server/vfo/jsp/VfoSubmit.jsp?show=${SHOW}&shot=${SHOT})"
    seqls
     seqls *.rla *.cin
   echo $SHOW
   echo $SHOT
   perl -e 'print "$ENV{SHOW} $ENV{SHOT}";'
   pwd   --- # this should print the current directory  example - /net/vol01/shot/curtest.../2fa
and I need to strip out "net/vol01/"
so that
$FILE = /shot/cuetest/wrappers/pix/out/wrappers-2/2fa


So that finally the script looks like this-
#file bla.pl

#!/usr/local/bin/perl

use strict;

## get all the above unix commands ie ..show, shot, filespec

## and then does this...
if ( 0 != system( "netscape -remote 'openUrl(http://vfo-server/vfo/jsp/VfoSubmit.jsp?show=$ENV{SHOW}&shot=$ENV{SHOT}&owner=$ENV{owner}&file=/whatever )' 2> /dev/null" ) ) {

    print "Netscape not running, launching fresh browser\n";

    system( "netscape 'http://vfo-server/vfo/jsp/VfoSubmit.jsp?show=$ENV{SHOW}&shot=$ENV{SHOT}&owner=$ENV{owner}&file=/whatever' 2> /dev/null" );

}

Any suggestions...

Thanks



0
Comment
Question by:sdesar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
andreif earned 50 total points
ID: 6970664
To execute shell command you can use different ways:

# the easiest way, $output will contain command line output
$output = `command`;

# you can use system(), it returns exit code returned by UNIX programm

$code = system("commands");
0
 

Author Comment

by:sdesar
ID: 6972469
how do i search for a string that -
"/net/vol01/shot/curtest.../2fa.ca"

and I need to print everything from "/shot... " onwords...
so that
$FILE = /shot/cuetest/wrappers/pix/out/wrappers-2/2fa

Any suggestions....
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
cpan issue 1 66
pattern matching in perl 2 111
XML::LibXML and Xpath syntax How do I get attribute of sibling 2 161
perl syntax 3 35
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question