shell command命令
近期遇到一個比較少見的命令command,詳細如下:
command 是一些shell的內建命令
我本機使用的是dash,伺服器使用的是bash,其他shell沒有測試
- dash
user@PC:~/debug/bin/test$ ll /bin/sh
lrwxrwxrwx 1 root root 4 12月 8 2015 /bin/sh -> dash*
user@PC:~/debug/bin/test$ type command
command 是 shell 內建
- bash
[email protected]:~/work/tina$ ll /bin/sh
lrwxrwxrwx 1 root root 9 4月 20 16:15 /bin/sh -> /bin/bash*
[email protected]:~/work/tina$ type command
command 是 shell 內建
command命令的作用
無視shell指令碼中的“同名”函式,執行特定的命令
- dash
下面摘自man dash
command [-p] [-v] [-V] command [arg ...]
Execute the specified command but ignore shell functions when searching for it.
(This is useful when you have a shell function with the same name as a builtin com‐
mand.)
-p search for command using a PATH that guarantees to find all the standard util‐
ities.
-V Do not execute the command but search for the command and print the resolution
of the command search. This is the same as the type builtin.
-v Do not execute the command but search for the command and print the absolute
pathname of utilities, the name for builtins or the expansion of aliases.
- bash
下面摘自man bash
command [-pVv] command [arg ...]
Run command with args suppressing the normal shell function lookup. Only builtin
commands or commands found in the PATH are executed. If the -p option is given,
the search for command is performed using a default value for PATH that is guaran‐
teed to find all of the standard utilities. If either the -V or -v option is sup‐
plied, a description of command is printed. The -v option causes a single word
indicating the command or filename used to invoke command to be displayed; the -V
option produces a more verbose description. If the -V or -v option is supplied,
the exit status is 0 if command was found, and 1 if not. If neither option is sup‐
plied and an error occurred or command cannot be found, the exit status is 127.
Otherwise, the exit status of the command builtin is the exit status of command.
測試
在test.sh中構建ls函式,測試command命令的作用
[email protected]:~/debug/bin/test$ ls
test.sh
[email protected]:~/debug/bin/test$ cat test.sh
function ls()
{
echo "haha"
}
echo "--1--"
ls
echo "--2--"
command ls
echo "--3--"
echo command ls
echo "--4--"
$(echo command ls)
[email protected]:~/debug/bin/test$ ./test.sh
--1--
haha
--2--
test.sh
--3--
command ls
--4--
test.sh
相關推薦
shell command命令
近期遇到一個比較少見的命令command,詳細如下: command 是一些shell的內建命令 我本機使用的是dash,伺服器使用的是bash,其他shell沒有測試 - dash user@PC:~/debug/bin/test$ ll /bin/
linux shell將命令結果賦值給變數 shell assign command output to variable
1. 命令 1.1 反引號`` (也就是tab上面~鍵) ~ a=`echo "hello world"
系統管理:shell基本命令1
ring 長度 ash linu 相同 文件的 提高 自動 tail 1.shell簡介 命令行:供用戶輸入命令的界面,本身只接受輸入,把命令傳遞給命令解釋器. shell:shell是命令解釋器,也是一個程序,在用戶和操作系統之間提供一個面向行的可交互接口.
shell--grep命令+正則表達式+基本語法
及其 gre awk 使用 part 開頭 合集 運算符 擴展 什麽是正則 正則就是用一些具有特殊含義的符號組合到一起(稱為正則表達式)來描述字符或者字符串的方法。或者說:正則就是用來描述一類事物的規則。 在linux中,通配符是由shell解釋的,而正則表達式則是由命令解
shell test 命令、循環語句
use str 技術分享 login div 空格 image mage 權限操作 test 命令、循環語句 test命令格式: test condition 通常,在if-then-else語句中,用[]代替,即[ condition ]。註意,方括號兩邊都要有空格。 常
Shell find命令詳解
一個 打印 文件訪問 perm mtime -o 多次 所有者 cut 查找文件find ./ -type f查找目錄find ./ -type d查找名字為test的文件或目錄find ./ -name test查找名字符合正則表達式的文件,註意前面的‘.*’(查找到的文
shell grep 命令大全
.sh 正則表達 -c 單個 文件 強制 extend round xtend grep: 用於模糊查找,在標準輸入或者文件中 格式: grep [選項參數]... PATTERN |FILE ... 選項參數說明: -E, --extended-regexp PAT
shell cut 命令
根據 shel src mit 切分 character mage 分享 cat 含義: 根據分隔符,按列切分文件 語法格式:cut [選項]... [文件]... -c, --characters 按照字符 -f, --fields 按照列 -d, --
shell--7、Shell test 命令
shell test 命令Shell中的 test 命令用於檢查某個條件是否成立,它可以進行數值、字符和文件三個方面的測試。數值測試參數說明-eq等於則為真-ne不等於則為真-gt大於則為真-ge大於等於則為真-lt小於則為真-le小於等於則為真實例演示:num1=100 num2=100 if test $
Shell常用命令
shell前面的話 自以為前端工程師可能用不到Shell命令。但在學習Git時,發現除了Git命令,還有好多是需要Shell命令來配合的。所以,Shell命令需要系統的學習並進行總結,本文將詳細介紹shell常用命令 特殊字符 特殊字符對shell具有特殊含義,不要把它們當作普通字符使用。某些特殊字符用於
adb shell dumpsys 命令 查看內存
mail 內存 創建 name spa gif http 例如 table http://blog.csdn.net/xyz_lmn/article/details/7001892 android程序內存被分為2部分:native和dalvik,dalvik就是我們平常說的
linux中shell curl命令獲取http狀態碼
linux中shell curl命令獲取http狀態碼linux中shell curl命令獲取http狀態碼通過curl的-w參數我們可以自定義curl的輸出,%{http_code}代表http狀態碼 代碼如下 復制代碼# curl -I -m 10 -o /dev/null -s -w %{http_co
Shell-2-命令之樂
xargs img 錄制 mysql -type linux 批量 pre 所有權 1.cat (1)基本用法 [[email protected]/* */ tmp]# cat 1.txt 2.txt this is a test1 this is a
WPF中的Command命令詳解
cti system tle command location eric 自己的 pri edit 在WPF中使用命令的步驟很簡單 1.創建命令 2.綁定命令 3.設置命令源 4.設置命令目標 WPF中命令的核心是System.Windows.Input.ICommand接
getopts shell command -options parameters
unix 錯誤輸出 標準 ext uid dex 1.5 下一個 new 說明:原文網址http://blog.chinaunix.net/uid-26807463-id-3151601.html 獲取UNIX類型的選項: unix有一個優點就是標準UNIX命令在執行時
Shell 常用命令總結
com blog 所有 shell常用命令 grep命令 內容 cp命令 建立 bsp Shell常用命令總結 1 ls命令:列出文件 ls -la 列出當前目錄下的所有文件和文件夾 ls a* 列出當前目錄下所有以a字母開頭的文件 ls -l *.txt 列
5周第3次課 shell介紹 命令歷史 命令補全和別名 通配符 輸入輸出重定向
linux中shell介紹 命令歷史 命令補全和別名 通配符 輸入輸出重定向1.shell介紹shell 是一個命令解釋器,提供用戶和機器之間的交互。它支持特定語法,邏輯判斷、循環。比如,我們登陸的終端,它其實就是一個 shell,供我們和機器交互。Linux 下面有很多 shell,每個用戶都可以有自
Shell常用命令與vim編輯命令
類型 查看文件內容 另一個 郵編 輸出 逆序 分享 建立 htm 原博地址:https://www.cnblogs.com/BaiYiShaoNian/p/4831022.html Shell常用命令總結: 1、ls命令:列出文件 ls -a 列出當前目錄下的所有文件和文件
shell介紹 命令歷史 命令補全和別名 通配符 輸入輸出重定向
oot 歷史 tab鍵 運行 命令補全 cat man base 是什麽 8.1 shell介紹 shell 是一個命令解釋器,提供用戶和機器之間的交互 支持特定語法,比如邏輯判斷,循環 每個用戶都可以有自己特定的shell CentOS7默認shell 為bash(Bou
shell介紹/命令歷史/命令補全/通配符/輸出輸入重定向
時間 ima 顯示 work zsh 之前 img ole cgroup shell介紹 * shell是一個命令解釋器,提供用戶和機器之間的交互。 * 支持特定語法,比如邏輯判斷、循環。 * 每個用戶都可以有自己特定的shell。 * Centos7默認shell為