LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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: 201
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
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
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: 201

Original Poster
Blog Entries: 3

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
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
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: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:19 PM.

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