What is the difference of 'exec cmd &' and 'cmd &' in bash scripting?

What is the difference between the following fork statements ?

  1. command &
  2. exec command &

You can use wait $! for both statements. In my test I have found no difference in the behavior - but maybe I'm missing something.

Answers


The & overrides the exec since you can't both replace the existing process with a new process and run the new process in the background.


Need Your Help

Heroku, hoe gem is not in gemlist, gemfile, gemfile.lock. Why is it trying to install it anyways?

ruby-on-rails git heroku

I'm trying to push to Heroku and it insists on trying to install a gem I do not have anywhere in my app. I've have the latest changes committed to my git repo. The gem is hoe. I've tried the vers...

Color/Line labels are being sorted alphabetically in ggplot. How to avoid?

r plot ggplot2

I'm trying to draw 3 lines from my data set on the same graph, and display them using ggplot2.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.