Ko dara Builtin komandējums Bash?

Satura rādītājs:

Ko dara Builtin komandējums Bash?
Ko dara Builtin komandējums Bash?

Video: Ko dara Builtin komandējums Bash?

Video: Ko dara Builtin komandējums Bash?
Video: Disabling SMBv1 - YouTube 2024, Aprīlis
Anonim
Bušas komandas Bashā var būt ļoti noderīgas, bet to, ko pati faktiski dara "builtin"? Šodienas SuperUser Q & A ziņai ir atbilde uz ziņkārīgo lasītāja jautājumu.
Bušas komandas Bashā var būt ļoti noderīgas, bet to, ko pati faktiski dara "builtin"? Šodienas SuperUser Q & A ziņai ir atbilde uz ziņkārīgo lasītāja jautājumu.

Šodienas jautājumu un atbilžu sesija mums priecājas par SuperUser - Stack Exchange dalību, kas ir kopienas vadīta Q & A tīmekļa vietņu grupa.

Jautājums

SuperUser lasītājs lfalin vēlas uzzināt, kas darbojas Bash komandā:

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?

Ko darīt Bash veiktā iekšējā komanda?

Atbilde

SuperUser ieguldītājs Spiff ir atbilde mums:

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

Vai kaut ko pievienot paskaidrojumam? Skatieties komentāros. Vēlaties lasīt citas atbildes no citiem tehnoloģiju savvy Stack Exchange lietotājiem? Šeit skatiet pilnu diskusiju pavedienu.

Ieteicams: