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 10-15-2015, 04:37 AM   #1
bloodstreetboy
Member
 
Registered: May 2012
Posts: 198
Blog Entries: 3

Rep: Reputation: 37
bash in built functions


I want to list all bash inbuilt function and How can I add my user defined function in the list of in built function of bash.
 
Old 10-15-2015, 04:43 AM   #2
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 1,689

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
You find the list of all builtins in the reference manual https://www.gnu.org/software/bash/ma...iltin-Commands.

I don't think that you can add functions to the shell itself, but it's easy to add your own functions to, say, /etc/profile.d. To write a function, see https://www.gnu.org/software/bash/ma...hell-Functions.
 
Old 10-15-2015, 05:51 AM   #3
bloodstreetboy
Member
 
Registered: May 2012
Posts: 198
Blog Entries: 3

Original Poster
Rep: Reputation: 37
Thanks for replying, so it appears in built functions are nothing but commands that we can use on terminal or in a shell script.
Bur are the external functions or commands like ls or mkdir or date or rm acted as process?
suppose if I remove large number of files using rm command and it takes 10 minutes to remove all files so rm will be appear as a process in 10 minutes until it completes.

Any in built function that I can run up to 10 minutes?

Last edited by bloodstreetboy; 10-15-2015 at 06:20 AM.
 
Old 10-15-2015, 08:16 AM   #4
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 1,689

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
Indeed, external commands run as separate processes, builtins run as part of the shell.

If you need a longrunner - strictly speaking, it's not a builtin, but like a builtin it runs as part of the shell:
Code:
while :
do :
done
 
1 members found this post helpful.
Old 10-15-2015, 08:50 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,294

Rep: Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347
Basically bash is just another program that has SOME functionality built in; read the man page for a complete list.
http://linux.die.net/man/1/bash

Other functionality is provided by calling 'external' programs like the ones you listed.

You can also add to the shell's apparent functionality by creating functions in a script and sourcing that or just adding them directly into eg .bashrc.

http://tldp.org/LDP/abs/html/functions.html
 
  


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
Problem using functions with bash isdigit Linux - Newbie 3 12-24-2009 07:21 PM
functions in bash scripting wvw Programming 4 05-14-2009 05:22 PM
Functions in bash script som_kurian Programming 3 01-01-2008 09:12 AM
overloading built-in functions in perl bigearsbilly Programming 0 11-12-2004 07:19 AM
C built-in function for a Bash script Linh Programming 3 04-23-2004 09:23 AM


All times are GMT -5. The time now is 10:25 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