![](/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.