本文介绍了Linux中的shell内置命令是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用Linux,我很好奇如何定义诸如cd这样的shell内置命令.

I have just started using Linux and I am curious how shell built-in commands such as cd are defined.

此外,如果有人能解释它们的实现和执行方式,我将不胜感激.

Also, I'd appreciate if someone could explain how they are implemented and executed.

推荐答案

如果您想了解bash内置函数是如何定义的,那么您只需要查看 Bash手册页的第4部分.

If you want to see how bash builtins are defined then you just need to look at Section 4 of The Bash Man Page.

但是,如果您想了解实施的bash方式,则需要查看 Bash源代码,因为这些命令已编译到bash可执行文件中.

If, however, you want to know how bash bultins are implemented, you'll need to look at the Bash source code because these commands are compiled into the bash executable.

查看命令是否为内置bash的一种快速简便的方法是使用help命令.例如,help cd将向您展示如何定义"cd"的bash内置函数.对于help echo类似.

One fast and easy way to see whether or not a command is a bash builtin is to use the help command. Example, help cd will show you how the bash builtin of 'cd' is defined. Similarly for help echo.

这篇关于Linux中的shell内置命令是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 13:03
查看更多