title: How to launch a program from bash script, then close Terminal but keep the program alive
body: <p>I wanted to have an icon in my desktop to start <a href="http://jonls.dk/redshift/" rel="nofollow noreferrer">Redshift</a> with a custom parameter which is read from the command line upon launching.</p>
  
  <p>This is what I came up with:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>#!/bin/bash
  default_temperature=4500
  echo "Default color temperature (Night) is "$default_temperature"K."
  read -p "Type in the desired value: " temperature
  temperature=${temperature:-$default_temperature}
  nohup redshift-gtk -l "-23.9141:-147.6650" -t "6500:"$temperature &amp;
  </code></pre>
  
  <p>The above file is saved as <code>/home/redshift.sh</code>. I also created a desktop entry to launch it, with the following code:</p>
  
  <pre class="lang-none prettyprint-override"><code>#!/usr/bin/env xdg-open
  [Desktop Entry]
  Name=Redshift (script)
  Comment=Custom script to start Redshift with color temperature input
  Exec="/home/redshift.sh"
  Icon=redshift
  Terminal=true
  Type=Application
  </code></pre>
  
  <p>(the first line was added automatically).</p>
  
  <p>The expected behaviour is:</p>
  
  <ol>
  <li>User double-clicks the desktop entry</li>
  <li>Console opens and asks for (optional) input</li>
  <li>Upon user pressing <kbd>Enter</kbd>, the script should launch the application named <code>redshift-gtk</code> (which is actually a Python script located at <code>/usr/bin</code>), with the specified arguments.</li>
  </ol>
  
  <p>For now I don't care about checking whether the input is valid, nor if the process is already running.</p>
  
  <p>An example of the (working) command would be:</p>
  
  
  
  <pre class="lang-sh prettyprint-override"><code>redshift-gtk -l "-23.9141:-147.6650" -t "5500:2400"
  </code></pre>
  
  <p>And for the moment, I even simplified the launch script to simply this</p>
  
  <pre class="lang-sh prettyprint-override"><code>nohup redshift-gtk -l "-23.9141:-147.6650" -t "5500:2400" &amp;
  </code></pre>
  
  <p>And even tried</p>
  
  <pre class="lang-sh prettyprint-override"><code>nohup redshift-gtk -l "-23.9141:-147.6650" -t "5500:2400" &amp;&amp; exit
  </code></pre>
  
  <p>But none of these closes the Terminal window, it will just keep remain open. If I close it manually, the Redshift process is killed (and this is obviosly not desired).</p>
  
  <p>Tried a number of possible solutions found online, none seems to work. Didn't find anything relevant here in SO.</p>
  
  <p>Just how to do it properly?</p>
  
  <p>Thanks</p>