Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: ClearCase Command text in Backticks is ignored

by Deep_Plaid (Acolyte)
on May 08, 2013 at 16:16 UTC ( #1032630=note: print w/replies, xml ) Need Help??


in reply to Re: ClearCase Command text in Backticks is ignored
in thread ClearCase Command text in Backticks is ignored

Hi Ken,

Thanks so much for your fast reply. Escaping the back slashes in the format option worked! The output using system does the format properly now. Code:
$output = system("cleartool lsco -r -brt p_JOESDRUGS_DT_Int -fmt \"%En +\\t%u\\n\"");

The zero is still at the end, but I can always chop that off. Output:

.\EDC_Export\Test_file2.txt mkjohnson .\EDC_Export\Test_file3.txt mkjohnson 0

However, I still haven't solved the first issue. I tried your advice, and this solves the problem of recognizing the content of $stream, but the command fails. I also tried it with including the double quotes escaped:

$output = system('cleartool', 'lsco', '-r', '-brt', $stream, '-fmt', ' +\"%En\\t%u\\n\"');

But that still fails. However, a different failure, so I'm getting closer. It's a cleartool error and it reveals it can read $stream. Output:

cleartool: Warning: Type not found: "p_JOESDRUGS_DT_Int". 0

So I am getting closer. I will try playing around with this combination, but any further advice would be greatly appreciated. Thanks again.

Replies are listed 'Best First'.
Re^3: ClearCase Command text in Backticks is ignored
by kennethk (Abbot) on May 08, 2013 at 16:41 UTC
    The zero is still at the end, but I can always chop that off
    If your code is essentially
    my $output = system(...); print $output;
    then you should note that system returns the status code returned by the call, not the output of the call. There's no reason to do the print, and probably no reason to capture the return.
    I also tried it with including the double quotes escaped
    The question I should have included up front is "What is the exact syntax that works on the command line?" If you pass system '\"%En\\t%u\\n\"', I believe it should be equivalent to entering '\\"%En\\t%u\\n\\"' on the CLI, which I think is unlikely to be what you intend.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032630]
help
Chatterbox?
[Corion]: marto: Ow! I would assume there is a cron job monitoring the free disk space and automatically opening a ticket at 90%, 95% and 100% usage...
[Corion]: Even we had automatic emails back when we maintained the machine ourselves...
[marto]: Corion you under estimate how lazy these admins are :P
[Discipulus]: we too; using opsview alarms
[marto]: the key word: outsourcing ;)
[Corion]: marto: Yeah, feels like that ;) You could set up the cronjob that auto-creates tickets :-))
[marto]: the ticketing system does not accept calls via email, nor has it a working API. It's tied into Active Directory for authentication and the Solaris boxes aren't on that domain
[Corion]: The one thing I haven't figured out a solution to is how to get an edge-trigger instead of sending an email every 5 minutes if the usage is above 90%. I want one mail when it goes over 90% but no more emails as long as it stays between 90% and 95%.
[Corion]: marto: Clever! ;)
[Corion]: You can only reach me by pager

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2017-01-24 10:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (203 votes). Check out past polls.