首页 > 其他分享 >Command: command & type

Command: command & type

时间:2023-03-25 12:34:27浏览次数:24  
标签:bin exists pwd Command usr action command type

 

command

command 只能跳过function,而不能跳过shell builtin

 

 

三个选项 -vV都是打印 -p 使用 default PATH 执行命令

 

 

bash默认PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

 

 

 

getconf retrieve the values POSIX or system configuration variables

command -p getconf PATH

 

 

 

Reimplement command

function command() {
    echo 'execute shell builtin `command` with args' "$@"
    builtin command "$@"
}

 

 

 

type

 

 

 

 

#!/bin/env sh

source /etc/rc.d/init.d/functions

function pwd(){
        action pwd true
}

echo -e '\e[7;45mDirect run pwd\e[0m'

pwd

echo -e '\e[5;42mRun command pwd\e[0m'

command pwd

if command -v pwd &> /dev/null;then
        action 'pwd exists?' true
else
        action 'pwd exists?' false
fi


if command -pv pwd >& /dev/null;then
        action 'System pwd exists?' true
else
        action 'System pwd exists?' false
fi

 

标签:bin,exists,pwd,Command,usr,action,command,type
From: https://www.cnblogs.com/dissipate/p/17254505.html

相关文章

  • Mac开发_NSButtonType
    //不同类型的按钮的样式和行为。typedefNS_ENUM(NSUInteger,NSButtonType){//短暂的亮度按钮,按下时会变亮,松开后恢复原状。NSButtonTypeMomentaryLight......
  • how to set static ip using command line for kali linux
    HowtoconfigureKaliLinuxtouseastaticIPaddresshttps://miloserdov.org/?p=542  sudovim/etc/network/interfaces  autoeth0ifaceeth0inets......
  • about gpasswd/chown/umask/chgrp/chmod command in linux
    adminuserusesudocanbedo:(拥有sudo权限应该做什么?)1:add<username>to<groupname>groupsudogpasswd-a<username><groupname>2:remove<username>from<group......
  • office2010加载mathtype
    salute:word打开提示无法加载此程序mathpage.wll_word无法加载此加载项程序_maboii的博客-CSDN博客salute:Word粘贴时出现“文件未找到:MathPage.WLL”的解决方案-知乎(......
  • Object.toString与Object.prototype.toString区别
    1、Object原型链上的toString方法可以用于对象类型的判断,如常用的区分数组与普通对象。例如:Object.prototype.toString.call('');//[object......
  • prototype
    Javascript的继承机制基于原型,而不是Class类凡是通过newFunction()创建的对象都是函数对象,其他的都是普通对象普通对象没有prototype,但有__proto__属性prototype......
  • 开心的档之TypeScript 变量声明
    变量是一种使用方便的占位符,用于引用计算机内存地址。我们可以把变量看做存储数据的容器。TypeScript变量的命名规则:变量名称可以包含数字和字母。除了下划线_和美元$......
  • Linux shell set command All In One
    LinuxshellsetcommandAllInOneerros❌unbound-variable#$1:unboundvariableif(($1))thenecho$1#arg=$1#tsGenerator$arg#tsGenerator......
  • what are the primitive types of C++?
    InC++,thereareseveralprimitivedatatypes,whicharealsoknownasfundamentalorbuilt-indatatypes.Theseinclude:Integertypes:Usedtorepresentw......
  • 关于Could not autowire. No beans of 'xxxx' type found. 解决方法之一
    关于Couldnotautowire.Nobeansof'xxxx'typefound.解决方法之一原因:启动类与配置类是在一个包下但是不同包而且配置类也不是子包启动类没扫描到配置类这时......