Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 06-12-2003, 11:02 AM   #1
Registered: Apr 2003
Posts: 178

Rep: Reputation: 30
Converting bash command to C code

What is the equivalent built in function call in C to kill a process and to shutdown an ethernet card?

Bash code
1) killall smbd > /dev/null
2) ifconfig eth0 down > /dev/null

C code ?

Old 06-12-2003, 12:33 PM   #2
Registered: Dec 2002
Location: San Luis Obispo, CA
Distribution: Fedora Core 3
Posts: 618

Rep: Reputation: 30
man system

man execvp

I think one of those should help
Old 06-12-2003, 03:21 PM   #3
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 110Reputation: 110

man 2 kill
Old 06-13-2003, 10:39 AM   #4
LQ Newbie
Registered: Sep 2002
Distribution: Red Hat 7.3
Posts: 7

Rep: Reputation: 0

If there is a specific C funtion that works then go with that but the less desireable, efficient or professional way would be to use a system command included in unistd.h system("..."); You can use any command that you would issue from the bash prompt just through your application.



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
Converting extended ascii (,) in bash script Hko Programming 4 12-29-2012 03:42 AM
Converting Windows DLL code to Linux shared library DavidW567 Programming 7 07-27-2010 08:15 AM
bash script for converting ps to pdf juergenkemeter Linux - General 3 10-10-2005 04:35 PM
converting vb6 code to python mrobertson Programming 2 06-02-2005 01:27 PM
Bug in c code calling bash code Linh Programming 11 08-12-2003 04:27 AM

All times are GMT -5. The time now is 02:31 PM.

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