Cosa fa il comando integrato in Bash Do?

Sommario:

Cosa fa il comando integrato in Bash Do?
Cosa fa il comando integrato in Bash Do?

Video: Cosa fa il comando integrato in Bash Do?

Video: Cosa fa il comando integrato in Bash Do?
Video: Securing SMB (Read Note in Description) [Windows Server 2019] - YouTube 2024, Aprile
Anonim
I comandi incorporati in Bash possono essere estremamente utili, ma cosa fa realmente "builtin" stesso? Il post di Q & A di SuperUser di oggi ha la risposta alla domanda di un lettore curioso.
I comandi incorporati in Bash possono essere estremamente utili, ma cosa fa realmente "builtin" stesso? Il post di Q & A di SuperUser di oggi ha la risposta alla domanda di un lettore curioso.

La sessione di domande e risposte di oggi ci viene fornita per gentile concessione di SuperUser, una suddivisione di Stack Exchange, un raggruppamento di domande e risposte basato sulla comunità.

La domanda

Il lettore SuperUser lfalin vuole sapere che cosa fa il comando incorporato in Bash:

I know what a builtin command is, but what does builtin itself do? Executing which ls shows me /bin/ls, but executing which builtin returns nothing. man builtin just gives me a list of builtin commands, one of which is builtin. The rest of the man page explains what a builtin command is, but not what builtin itself is. builtin –help tells me builtin: usage: builtin [shell-builtin [arg …], but still not what it does. Is it a part of Bash in a way that other builtin commands are not?

Cosa fa il comando incorporato in Bash?

La risposta

Collaboratore SuperUser Spiff ha la risposta per noi:

The builtin command makes sure you run the shell built-in version of the command rather than running another command with the same name.

For example, imagine you defined a shell function named cd to print some extra status every time you change directories, but you messed it up and now you cannot change directories correctly. So now you can type builtin cd ~ to successfully cd back to your home directory without running your broken shell function.

By the way, my copy of the Bash man page has a section called “SHELL BUILTIN COMMANDS”, and it defines the meaning of the builtin command in that section (transcribed below).

Image
Image

Hai qualcosa da aggiungere alla spiegazione? Audio disattivato nei commenti. Vuoi leggere più risposte dagli altri utenti di Stack Exchange esperti di tecnologia? Controlla la discussione completa qui.

Consigliato: