You are not logged in.

#1 2017-10-08 08:16:12

ap
Member
Registered: 2017-08-09
Posts: 47

[SOLVED] when should I use "&" for autostart of a program?

Hi, sorry for the super noob question smile
Why for some programs one should autostart the program with an & (e.g., conky &) while in some cases the & is not needed?

I know this may sound a silly question, but I would like to know what that & does and under which cases I should autostart a program by putting & at the end.

Thanks!

PS: couldn't find an answer on the web to this simple question...

Last edited by ap (2017-10-08 10:32:38)

Offline

#2 2017-10-08 08:55:25

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: [SOLVED] when should I use "&" for autostart of a program?

Offline

#3 2017-10-08 09:18:08

ap
Member
Registered: 2017-08-09
Posts: 47

Re: [SOLVED] when should I use "&" for autostart of a program?

I see....I am not a native English speaker and I didn't know the symbol is called ampersand. I was looking for 'and' and couldn't find anything while I see there are a few explanations when searching for 'ampersand'...so if I understand right, ampersand allows to execute a process in the background...but practically what's the difference then between a 'conky &' and 'conky' and why it is preferred to run it in a way compared to the other? thanks smile

Offline

#4 2017-10-08 09:44:04

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,741

Re: [SOLVED] when should I use "&" for autostart of a program?

Ampersand will drop it to background, so the script may continue (not all need that, there was a thread about that).

You can probably test in cli with

program && echo "hi"

If there is hi, then it probably doesn't need &.

Last edited by brontosaurusrex (2017-10-08 09:48:11)

Online

#5 2017-10-08 10:19:17

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: [SOLVED] when should I use "&" for autostart of a program?

ap wrote:

I know this may sound a silly question, but I would like to know what that & does and under which cases I should autostart a program by putting & at the end.

It is an excellent question smile

My simple test is to run the given command from a terminal and if it returns the prompt then an ampersand should *not* be used.

BunsenLabs changed the openbox autostart script to remove superfluous ampersands (and their associated `sleep`s) because we noticed conflicts could occur otherwise.

Offline

#6 2017-10-08 10:32:04

ap
Member
Registered: 2017-08-09
Posts: 47

Re: [SOLVED] when should I use "&" for autostart of a program?

Thanks guys,always very helpful and kind smile Now it's very clear and I understand the use of ampersand in autostarting a program. I'll mark this as solved.

Offline

#7 2017-10-08 10:58:14

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: [SOLVED] when should I use "&" for autostart of a program?

The etymology is interesting for ampersand & and etc etc...

http://www.etymonline.com/index.php?all … =ampersand

Offline

Board footer

Powered by FluxBB