Što radi naredba izgrađenog u Bash-u?

Sadržaj:

Što radi naredba izgrađenog u Bash-u?
Što radi naredba izgrađenog u Bash-u?

Video: Što radi naredba izgrađenog u Bash-u?

Video: Što radi naredba izgrađenog u Bash-u?
Video: Hướng dẫn cài Scan SMB trên Windows 11 cho máy Photocopy Ricoh Aficio MP5001 thành công 100% - YouTube 2024, Ožujak
Anonim
Ugrađene naredbe u Bashu mogu biti iznimno korisne, ali što zapravo zapravo čini "ugrađeni"? Danas SuperUser Q & A post ima odgovor na pitanje čudnog čitatelja.
Ugrađene naredbe u Bashu mogu biti iznimno korisne, ali što zapravo zapravo čini "ugrađeni"? Danas SuperUser Q & A post ima odgovor na pitanje čudnog čitatelja.

Današnja pitanja i odgovori nam se javljaju zahvaljujući SuperUseru - podjele Stack Exchange-a, zajednice-driven grupiranja Q & A web stranica.

Pitanje

SuperUser čitač lfalin želi znati što ugrađena naredba u Bashu radi:

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?

Što čini ugrađena naredba u Bashu?

Odgovor

Klijentica SuperUser-a Spiff ima odgovor za nas:

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

Imate li nešto za objašnjenje? Zvuči u komentarima. Želite li pročitati više odgovora od drugih tehnoloških korisnika Stack Exchangea? Pogledajte ovdje cijelu raspravu.

Preporučeni: