I want to open my terminal with some commands executed in it on bootup. So I wrote a script with following line in it:

gnome-terminal --tab -t "MyPC" -e "sh -c 'firefox &;exec bash'" --tab -t "MYPC2" -e "sh -c 'ls;exec bash'"

In this firefox & is not executing, however if I write only firefox it executes. So only the second tab is opening not the first one

I know it's some spacing issue. If I write just ls that also executes.

What is the correct syntax? Why is it not taking spacing??

  • How do you invoke this at boot up of the computer? How do wait for X to start?
    – Anthon
    Dec 15 '14 at 7:23
  • +1 to make up for the uncommented downvote. Don't see anything wrong with the question.
    – Minix
    Dec 15 '14 at 8:17

Putting a ; after a & does not work. & is already a command separator, specifying, that the command should be run in the background, so ; is not required.

Try removing the ; and report back.

  • It worked after removing ;. Thanks Dec 15 '14 at 8:12
  • @SiddharthTrikha Glad I could help and welcome to Unix&Linux SE.
    – Minix
    Dec 15 '14 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.