Solved

How to get the echo command via perl?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
problem with using the glob function 1 63
syslog unix file 20 68
Parse csv file and generate graphs in HTML in bash 8 156
Matching a random pattern with one common character 2 42
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 …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now