ampersand at beginning of a line in csh

房东的猫 提交于 2019-12-05 19:28:05

Found something interesting:

The semicolon (;) character separates successive commands on a single command line. For example,

% <command1> ; <command2>

executes <command1>, and when it finishes, <command2> gets executed.

The ampersand character (&) is similar to the semicolon (;) but does not wait for <command1> to finish.

Maybe it's treating it like an empty command?

The best way to answer will be example. Taking idea of JoelFAn ahaed:

EXAMPLE 1

user$ date ; sleep 5s ; date

Thu Apr 5 10:46:45 IST 2012

Thu Apr 5 10:46:50 IST 2012

EXAMPLE 2

user$ date & sleep 5s & date

[1] 18371

[2] 18372

Thu Apr 5 10:47:09 IST 2012

Thu Apr 5 10:47:09 IST 2012

[1] - Done date

EXAMPLE3

user$ bg

[2] sleep 5s &

The examples are self explanatory.

Thanks

T.E.D.

I can't find anything in csh docs about it. However, I know in make it suppresses any output from the command (but still runs it). Perhaps that's what it is doing.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!