LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-13-2011, 04:52 PM   #1
jeriryan
Member
 
Registered: Apr 2003
Location: United States
Distribution: RHEL 5.4, Snow Leopard
Posts: 87

Rep: Reputation: 15
Supressing shell error message within perl script


Hi all,

I'm a novice Perl scripter. I need to run a shell command from within my Perl script:
Code:
$deletedev=`echo 1>/sys/block/sdz/device/delete`;
and I can't figure out how to get the error to suppress when sdz doesn't exist. The error is:

Code:
sh: /sys/block/sdz/device/delete: No such file or directory
How can I hide this error?
 
Old 01-13-2011, 05:38 PM   #2
ForzaItalia2006
Member
 
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205

Rep: Reputation: 67
This error comes from the error stream. You need to capture the output and error stream. There are multiple ways to capture the error stream of a sub-process, e.g. search by "perl external command" (among others).

EDIT: For example, this link.

Hope that helps,
Andi

Last edited by ForzaItalia2006; 01-13-2011 at 05:39 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing arguments to shell script like perl script get-opts somupl86 Linux - Newbie 2 12-02-2010 11:14 PM
Anyone knows where this error/warning message s from for my simple perl script cliffyao Programming 7 03-17-2010 07:14 PM
MySQL Updates With Null When Perl Script Run From Shell Script ThisGuyIKnow Programming 6 08-12-2008 09:56 AM
Exiting the Shell script with Error MEssage sumitarun Programming 5 04-14-2005 01:10 AM
how to find the pid of a perl script from shell script toovato Linux - General 1 12-19-2003 06:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration