bash - GCC, what does -&& mean on the command line? -


i execute command this

echo 'int main(){printf("%lu\n",sizeof(void));}' | gcc -xc  -w -&& ./a.out 

and can result :1. can not find out -&& means,even after search man page , google!.and try execute without -&& option.it error this:

./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 

......

who knows option means?

-&& interpreted shell not single token, 2 separate tokens: - , &&. - token has no special meaning shell , passed argument gcc, interprets instruction read source standard input. && shell operator connects 2 commands in and clause: a && b execute b (a.out) if a (echo ... | gcc ...) has finished successfully.

the point of using gcc ... && ./a.out instead of simpler gcc ...; ./a.out run a.out if compilation has been successful, preventing stale a.out being executed.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -