Apa Perintah Built-in di Bash Do?

Daftar Isi:

Apa Perintah Built-in di Bash Do?
Apa Perintah Built-in di Bash Do?

Video: Apa Perintah Built-in di Bash Do?

Video: Apa Perintah Built-in di Bash Do?
Video: How to disable SMBv1 and enable SMB Signing on Windows through Group Policy - YouTube 2024, November
Anonim
Perintah builtin di Bash dapat sangat berguna, tetapi apa yang "builtin" sendiri sebenarnya lakukan? Posting SuperUser Q & A saat ini memiliki jawaban untuk pertanyaan pembaca yang ingin tahu.
Perintah builtin di Bash dapat sangat berguna, tetapi apa yang "builtin" sendiri sebenarnya lakukan? Posting SuperUser Q & A saat ini memiliki jawaban untuk pertanyaan pembaca yang ingin tahu.

Sesi Tanya & Jawab Hari ini hadir untuk memberi kami SuperUser - subdivisi Stack Exchange, pengelompokan situs web Q & A berbasis komunitas.

Pertanyaan

Pembaca SuperUser lfalin ingin tahu apa perintah builtin di 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?

Apa yang dilakukan perintah builtin di Bash?

Jawabannya

Kontributor SuperUser Spiff memiliki jawabannya untuk kami:

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

Memiliki sesuatu untuk ditambahkan ke penjelasan? Bicaralah di komentar. Ingin membaca lebih banyak jawaban dari pengguna Stack Exchange yang paham teknologi lainnya? Lihat diskusi lengkap di sini.

Direkomendasikan: