linux?type命令用法实战教程(linuxvi编辑器的用法)学到了

随心笔谈3年前发布 admin
221 0 0

文章摘要

这篇文章介绍了 shell 命令 `type` 的语法和用法。`type` 命令用于显示变量的类型或文件的类型。其语法为 `type [-afptP] name [name ...]`,支持多个选项: - `-t`:输出与 `NAME` 相关的类型信息(如 alias、keyword 等)。 - `-p`:显示可能执行的文件名或返回空值。 - `-a`:显示所有包含可执行文件的路径。 - `-f`:禁用函数查找。 - `-P`:强制搜索路径,即使 `NAME` 是 alias、builtin 或函数。 此外,文章还提到 `typeset` 命令已弃用,建议使用 `declare` 命令替代。

[root@new55 ~]#?type -a type?
type is a shell builtin
[root@new55 ~]#?help type?
type: type [-afptP] name [name …]
? For each NAME, indicate how it would be interpreted if used as a
? command name.
? If the -t option is used, `type’ outputs a single word which is one of
? `alias’, `keyword’, `function’, `builtin’, `file’ or `’, if NAME is an
? alias, shell reserved word, shell function, shell builtin, disk file,
? or unfound, respectively.
? If the -p flag is used, `type’ either returns the name of the disk
? file that would be executed, or nothing if `type -t NAME’ would not
? return `file’.
? If the -a flag is used, `type’ displays all of the places that contain
? an executable named `file’.? This includes aliases, builtins, and
? functions, if and only if the -p flag is not also used.
? The -f flag suppresses shell function lookup.
? The -P flag forces a PATH search for each NAME, even if it is an alias,
? builtin, or function, and returns the name of the disk file that would
? be executed.
typeset: typeset [-afFirtx] [-p] name[=value] …
? Obsolete.? See `declare’.
[root@new55 ~]#

© 版权声明

相关文章