LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash in built functions (https://www.linuxquestions.org/questions/linux-newbie-8/bash-in-built-functions-4175556213/)

bloodstreetboy 10-15-2015 04:37 AM

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.

berndbausch 10-15-2015 04:43 AM

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.

bloodstreetboy 10-15-2015 05:51 AM

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?

berndbausch 10-15-2015 08:16 AM

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


chrism01 10-15-2015 08:50 PM

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


All times are GMT -5. The time now is 05:38 AM.