- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: PERL - question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 09:20 AM
06-07-2005 09:20 AM
PERL - question
I used the following line in my PERL script to write the errors generated from a system command to a file "log"
system("/bin/cvs checkout -r$bra ivrsrc >>$log") || die "Cannot checkout CVS code from -r$bra";
But the messages from the system command is not written to the log file. It is instead appearing in the screen.
Can anyone please help.
Thanks,
Anand
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 09:22 AM
06-07-2005 09:22 AM
Re: PERL - question
system("/bin/cvs checkout -r$bra ivrsrc >>$log 2>&1")
HTH
-- Rod Hills
- Tags:
- redirect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 09:29 AM
06-07-2005 09:29 AM
Re: PERL - question
I tried it but does not seem to work. It does not print the messages on the STDERR now but does not write the messages to the log file either.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 09:31 AM
06-07-2005 09:31 AM
Re: PERL - question
I forgot the "&" needs to be escaped...
system("/bin/cvs checkout -r$bra ivrsrc >>$log 2>\&1")
(Otherwise perl interprets it as a subroutine call)
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2005 06:27 PM
06-07-2005 06:27 PM
Re: PERL - question
your problem is: CVS outputs the messages on standard error and >> will capture only standard output. To capture standard error you should use 2>.
Try this way:
system("/bin/cvs checkout -r$bra ivrsrc >>$log 2>>$log") || die "Cannot checkout CVS code from -r$bra";
Hope this helps,
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2005 05:46 AM
06-08-2005 05:46 AM
Re: PERL - question
Thanks for your help. But nothing seems to work.
I am trying it still now. The standard output seems to go to the log file but the standard error is getting displayed in the screen.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2005 06:24 AM
06-08-2005 06:24 AM
Re: PERL - question
system(...) || die ...;
Try something like this:
#!/usr/bin/perl
#
# this does not die:
#
system("echo hi mom >>/tmp/log 2>&1");
$errcode = $?;
printf("err code is ${errcode}\n");
eval ${errcode} == 0 || die "Cannot checkout CVS code from xyz";
#
# this DOES die:
#
system("NOREALCOMMAND hi mom >>/tmp/log 2>&1");
$errcode = $?;
printf("err code is ${errcode}\n");
eval ${errcode} == 0 || die "Cannot checkout CVS code from xyz";
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2005 06:29 AM
06-08-2005 06:29 AM
Re: PERL - question
eval `/bin/cvs checkout -r${bra} ivrsrc >>${log} 2>&1` || die "Cannot checkout CVS code from -r${bra}";
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2005 06:41 AM
06-08-2005 06:41 AM
Re: PERL - question
live free or die
harry d brown jr