![](/img/trans.png)
[英]what does the dollar sign mean in the substitution line of bash command “rename”
[英]GCC, what does -&& mean on the command line?
我執行這樣的命令
echo 'int main(){printf("%lu\n",sizeof(void));}' | gcc -xc -w -&& ./a.out
並可以得到結果:1.。 但即使在搜索手冊頁和google!之后,我也無法找到-&&的含義。並且我嘗試在沒有-&&選項的情況下執行它。這將是如下錯誤:
./a.out:1: error: stray ‘\317’ in program
./a.out:1: error: stray ‘\372’ in program
./a.out:1: error: stray ‘\355’ in program
./a.out:1: error: stray ‘\376’ in program
./a.out:1: error: stray ‘\7’ in program
./a.out:1: error: stray ‘\1’ in program
./a.out:1: error: stray ‘\3’ in program
./a.out:1: error: stray ‘\200’ in program
./a.out:1: error: stray ‘\2’ in program
./a.out:1: error: stray ‘\16’ in program
./a.out:1: error: expected identifier or ‘(’ before numeric constant
./a.out:1: error: stray ‘\6’ in program
./a.out:1: error: stray ‘\205’ in program
./a.out:1: error: stray ‘\31’ in program
./a.out:1: error: stray ‘\1’ in program
./a.out:1: error: stray ‘\31’ in program
./a.out:1: error: stray ‘\2’ in program
......
誰知道選項的意思?
Shell不會將-&&
解釋為單個標記,而是將其解釋為兩個單獨的標記: -
和&&
。 -
令牌對shell沒有特殊含義,它作為參數傳遞給gcc
,后者將其解釋為從標准輸入中讀取源代碼的指令。 &&
是在and子句中連接兩個命令的shell運算符:僅當A
( echo ... | gcc ...
)成功完成時, A && B
才會執行B
( a.out
)。
使用gcc ... && ./a.out
代替簡單的gcc ...; ./a.out
gcc ...; ./a.out
僅在編譯成功后才運行a.out
,從而阻止執行過時的a.out
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.