473,503 Members | 2,435 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to execute shell file in perl?

1 New Member
i have shell file which will execute set commands to activate the mesh interface in my CRB board.
in my perl file i tried to execute using system(location of file);
but am not getting correct output but it is returning true...

my code

$mesh_base="/mnt/jffs2/conf/mesh_start";
system($mesh_base);
Feb 28 '14 #1
2 1295
RonB
589 Recognized Expert Moderator Contributor
You don't have any error checking/handling on that system call, so how do you know it's returning true?

What output are you getting and how does that differ from what you expect?
Feb 28 '14 #2
miller
1,089 Recognized Expert Top Contributor
As RonB pointed out, you aren't checking to see if system succeeded. According to perldoc system, a true return value would actually be an indication of failure. If you don't want to worry about explicitly checking for success, use the autodie pragma.

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3. use autodie qw(:all);
  4.  
  5. my $mesh_base = '/mnt/jffs2/conf/mesh_start"'
  6. system($mesh_base);
  7.  
- Miller
Feb 28 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5652
by: Mohsin | last post by:
Hi all, I have a perl program which makes a user exit to the O/S (unix, solaris) to issue a O/S command. I know that the shell it invokes is NOT a korn shell, because I captured the shell info...
3
4295
by: Tomasz Ludwiniak | last post by:
Hi, I've little problem... I try to execute asp file ( which return XML file ) and use the result it in my asp script : set xml = Server.CreateObject("MSXML2.DOMDocument") xml.async=false...
2
1316
by: Big Santini | last post by:
Question: how to 'execute' different file types? in example when user choose ..doc file, the deafult application for .doc should run. jaro
1
1556
by: Watermark | last post by:
i need help i want to call shell from php i try exec and system but it isn't working please give me help to come out of this problem
2
6078
by: prakashpb | last post by:
Hello All, I am new to perl. I have to write some code in perl on windows. I have to invoke/run a shell file sample.sh from within perl file. When the perl while is executing, it should run to...
2
4457
by: mayurshah01 | last post by:
Hey guyz, I'm leaning c++. i wanna execute *.exe file using c++ pogramming. For example I have four *.exe files, a.exe b.exe c.ece d.exe Now i'll ask user for option that which file he/she...
4
19477
by: pizzetta72 | last post by:
Hi all, i just finish to install cygwin on windows XP adding also gcc compiler module. After I tried to execute a file called fstsg.0.3-sparc (www.fstha.com) used to cript a Unix shell, I receive...
4
2168
by: balnair | last post by:
I have a shell file in location /home/transfer/check.sh I need to excecute this shell file using python script
1
1001
by: Yogesh Sankar | last post by:
hi, i create setup deployment project and try to execute executable file placed in application folder directly after setup deployment complete..i succeed to place shortcut of that executable file on...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7258
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7313
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.