LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-18-2014, 02:11 PM   #1
neha2d
LQ Newbie
 
Registered: Jun 2014
Posts: 2

Rep: Reputation: Disabled
Use of System() function to execute shell command " Echo "


Hello,


I want to execute following command using system() function to write value "1" as string in a file.

The command that I am passing to system() as a string is:-

"echo 1 > /sys/class/gpio/goio14/value".

I want to write value 1 in the file "/sys/class/gpio/goio14/value". Also want to use system function() to execute the command.

When I am executing system() command, I am not getting any error but if I open the file and check for the file,file contains the older value that is 0 and new value is not getting written in the file.


I am not able to figure what the problem is. When program execution comes to the point of system() function

I am getting following message:
sh: can't create /sys/class/gpio/goio14/value: nonexistent directory

But the file "value" is already present at the mentioned path.

Any help regarding the same would be appreciated.
Thank You in advance.
 
Old 08-18-2014, 02:16 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by neha2d View Post
"echo 1 > /sys/class/gpio/goio14/value".
Typo? Shouldn't that be gpio14?
 
  


Reply



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
How to "pipe" function into "echo"? defila Programming 1 11-11-2013 05:58 AM
[Shell] Running "breake 2" command from parametr for function setevoy Programming 3 10-30-2013 08:22 AM
[SOLVED] Errors executing shell script: "command not found" and "no such file or directory" eko000 Linux - Newbie 1 01-14-2011 07:54 AM
linux operating system built-in telnet command can use "VT400" function keys and key? hocheetiong Linux - Newbie 1 05-27-2008 02:54 PM
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:47 AM.

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