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
Solved

How to get the echo command via perl?

Posted on 2002-04-25
2
218 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl program to obtain a machine's memory usage 6 23
Question about @INC variable in perl 1 65
PERL - Find newest folder 12 150
Perl script to process a .csv file 18 44
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…

860 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