在linux中,$*和[email protected]有什麼區別?
看了很多的相關文章,似懂非懂。現在,終於真正理解了它們兩者之間的區別。
首先我們看如下一個bash命令:
./start.sh "a b" "c" "d"
請問,給start.sh指令碼傳遞了幾個引數?
大部分人都知道,總共傳遞了3個引數,其中,$1等於a b,$2等於c,$3等於d。
現在,我們想在start.sh中呼叫另外一個指令碼begin.sh,同時將start.sh的引數傳給這個指令碼。
如果引數只有三個,那麼我們可以這樣寫:
begin.sh $1 $2 $3
如果引數不固定,可能有三個,可能有四個,那我們怎麼把引數傳遞給begin.sh呢?
我們可以這樣寫:
begin.sh
這種寫法等價於:
begin.sh $1 $2 $3...
此時在begin.sh中,$1等於a b,$2等於c,$3等於d
如果我們這樣寫:
begin.sh $*
那麼,這種寫法等價於:
begin "$1 $2 $3..."
此時在begin.sh中,$1等於a b c d。
[email protected]和$*的區別在於:[email protected]會把當前指令碼的引數獨立的傳遞給子指令碼($1 $2 $3),$*則把當前指令碼的引數合併為一個引數("$1 $2 $3")傳遞給子指令碼,子指令碼在讀取引數時,
相關推薦
在linux中,$*和<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="250165">[email160;protected]a>有什麼區別?
看了很多的相關文章,似懂非懂。現在,終於真正理解了它們兩者之間的區別。 首先我們看如下一個bash命令: ./start.sh "a b" "c" "d" 請問,給start.sh指令碼傳遞了幾個引數? 大部分人都知道,總共傳遞了3個引數,其中,$1等於a b,$2等
在linux中,$*和<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="90b4d0">[email160;protected]a>有什麼區別?
看了很多的文章,依然似懂非懂。現在,終於理解了它們兩者之間的區別。 $*會把當前指令碼的所有引數作為一個引數傳遞給子指令碼。(在英文中,*字元有“所有”的意思) [email protected]會把當前指令碼的所有引數分別作為一個引數傳遞給子指令碼。(在英文中,@字元有“獨立”的
Centos7 中[<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b7c5d8d8c3f7dbd8d4d6dbdfd8c4c3">[email160;protected]a> /] 和 [
1. [[email protected] /] 和 [[email protected] ~] 的區別 剛進入Centos時, 會顯示這個[[[email protected] ~] , 後邊讓輸入命令, 其實此時是在
verilog中assign和<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3859544f59414b78">[email160;protected]a>(*)兩者描述組合邏輯時的差別
verilog描述組合邏輯一般常用的有兩種:assign賦值語句和[email protected](*)語句。兩者之間的差別有: 1.被assign賦值的訊號定義為wire型,被[email protected](*)結構塊下的訊號定義為reg
淺談linux中shell變數$#,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="674327">[email160;protected]a>,$0,$1,$2,$?的含義解釋
淺談linux中shell變數$#,[email protected],$0,$1,$2,$?的含義解釋 下面小編就為大家帶來一篇淺談linux中shell變數$#,[email protected],$0,$1,$2的含義解釋。小編覺得挺不錯的,現在就分享給大家,
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fdae8d8f94939abdbc8889928a948f9899">[email160;protected]a>註解與省去get和set方法,
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/
linux <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="311571">[email160;protected]a>和$*區別
最近學習shell程式設計,發現 [email protected]和$*很有意思,分享一下 $* 取當前shell的所有引數,將所有的命令列視為單個字串,相當於“$1$2” [email protected] 取當前shell的所有引數保留引數裡的空白
Linux Bash Shell $*和<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ffdbbf">[email160;protected]a>的區別
在 Linux Bash Shell 中,$* 和 [email protected] 都表示引數列表中的所有引數,它們在具體使用中會有哪些不同呢?這裡我們可以寫一個 Shell 指令碼做實
[Happy BASH] BASH中的$*和<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="426602">[email160;protected]a>的區別
首先來看一段BASH程式碼: echo "\[email protected]=" [email protected] echo "\"\[email protected]\"=" "[email protected]" echo
shell腳本中的$# $0 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f8dcb8">[email160;protected]a> $* $$ $! $?的意義
腳本 $* width 上一個 pre shell int .cn height 轉載自:http://www.cnblogs.com/davygeek/p/5670212.html 今天學寫腳本遇到一些變量不認識,在此做下記錄。 變量 含義 $0 當前腳本的文件
shell中$*與<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b296f2">[email160;protected]a>的區別
劃分 位置 一個 這也 差異 獨立 [email protected] 情況 雙引號 $*所有的位置參數,被作為一個單詞 註意:"$*"必須被""引用 [email protected] 與$*同義,但是每個參數都是一個獨立的""引用字串,這就意味著參數
linux bash Shell特殊變數:Shell $0, $#, $*, <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8aaeca">[email160;protected]a>, $?
在linux下配置shell引數說明 前面已經講到,變數名只能包含數字、字母和下劃線,因為某些包含其他字元的變數有特殊含義,這樣的變數被稱為特殊變數。 例如,$ 表示當前Shell程序的ID,即pid,看下面的程式碼: [[email protected] /]$ ec
spring <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="62000d0d16222103010a0703000e07">[email160;protected]a>中value的理解
先看原始碼 /** * Names of the caches in which method invocation results are stored. * <p>Names may be used to determine the target cache (or cac
Springboot註解<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="260b0b666549485254494a4a4354">[email160;protected]a>和@RestCon
1.使用@Controller 註解,在對應的方法上,檢視解析器可以解析return 的jsp,html頁面,並且跳轉到相應頁面;若返回json等內容到頁面,則需要加@ResponseBody註解 [email protected]註解,相當於@[email protected
SQL Server資料庫mdf檔案中了勒索病毒<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fc9f8e858c889998a39d8f9d9293bc9f939f97">[email160;p
SQL,資料庫,勒索病毒,mdf檔案中毒,[email protected]_email *SQL Server資料庫mdf檔案中了勒索病毒[email protected]_email。副檔名變為[email protected]_email SQL Serv
面試題:一個字串包含英文和特殊字元,特殊字元不變,英文順序反過來,比如string str="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b4d0a4f5c6b">[email160
public class Reverse { public static void main(String[] args) { String str = "[email protected]!tk"; char[] chars = str.toCh
[ 轉]Shell中引數($0,$1,$#,$NF,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b6f0b">[email160;protected]a>等)的含義
Shell中引數($0,$1,$#,$NF,[email protected]等)的含義 釋出時間:2018-01-19 來源:網路 上傳者:使用者 &nbs
python基礎<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="775a5a37141b1604041a12031f1813">[email160;protected]a>和@staticmet
Python中3種方式定義類方法, 常規方式, @classmethod修飾方式, @staticmethod修飾方式. class A(object): def foo(self, x): print("executing foo(%s,%s)" % (self, x)
spring宣告式事務管理方式( 基於tx和aop名字空間的xml配置<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0922495d7b68677a686a7d6066676865">[email
轉自:https://www.cnblogs.com/niceyoo/p/8732891.html 1. 宣告式事務管理分類 宣告式事務管理也有兩種常用的方式, 一種是基於tx和aop名字空間的xml配置檔案,另一種就是基於@Transactional註解。 顯然基於註解的方式更簡單
Makefile有三個非常有用的變數。分別是<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a480e4">[email160;protected]a>,$^,$
原文地址:https://blog.csdn.net/u013774102/article/details/79043559 假設我們有下面這樣的一個程式,原始碼如下: /* main.c */ #include "mytool1.h" #include "mytool2.h" i