LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-05-2011, 01:09 PM   #1
r_s
Member
 
Registered: May 2009
Distribution: slackware, fedora, ubuntu
Posts: 98

Rep: Reputation: 21
creating a new binary


I need to change the functions of some linux commands. We can't edit the binary files provided in /bin, is there any other method other than alias.
For ex. - I need to change the function chmod so that it takes only three consecutive integers as input (chmod 777 filename) and nothing else ?
Do I have to write by own code for it, or is there any other alternate method.
 
Old 01-05-2011, 01:23 PM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
I think it would be better you describe what you want to achieve. I don't think that writing your own commands is a good Idea.

Markus
 
Old 01-05-2011, 01:24 PM   #3
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 13.1
Posts: 1,328

Rep: Reputation: 254Reputation: 254Reputation: 254
What's so bad with the original command? You could define a function and hide it from the user. Inside the function you can check for the proper arguments and call the real binary:

Code:
$ function chmod { echo "Hello"; }
$ chmod
Hello
Be aware, that either the user could still call the original command, or even install his own version.
 
  


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
creating binary for C code ravish.kanika Linux - Newbie 2 02-27-2008 05:46 AM
fstream.h is creating erratic binary programs sriram_16a SUSE / openSUSE 0 10-02-2007 12:48 AM
Creating/Distributing Linux Binary Files Sava Programming 3 08-29-2006 09:31 AM
Creating binary RPMS statically! Sunilsbjoshi Linux - Software 2 10-12-2005 12:10 AM
creating a flat binary file with gcc wsimmons Programming 2 01-08-2002 11:33 AM


All times are GMT -5. The time now is 07:24 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration