Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to get the echo command via perl?

Posted on 2002-04-25
2
Medium Priority
?
239 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 200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Six Sigma Control Plans

705 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