Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>UPDATED</strong></p> <p>Try something like this (OP's code modified a little bit):</p> <pre><code>#!/usr/bin/bash stop() { [ $CPID -ne 0 ] &amp;&amp; kill -INT $CPID &amp;&amp; wait $CPID &amp;&amp; echo "Killed $CPID"; } trap "stop; exit" INT CPID=0 while :; do read -p "Enter your number here: " YOURNUMBER stop [ "$YOURNUMBER" == quit ] &amp;&amp; break; TIMESTAMP=$(date +"%Y.%m.%d_%H.%M") avconv -f video4linux2 -r 3 -fs 52428800 -i /dev/video0 /home/$USER/orders/$YOURNUMBER/$TIMESTAMP-$YOURNUMBER.avi&amp; CPID=$! echo -e "Video complete!" done </code></pre> <p>This starts <a href="/questions/tagged/avconv" class="post-tag" title="show questions tagged 'avconv'" rel="tag">avconv</a> in the background so the user can enter a new number. Maybe the stdout and stderr of <a href="/questions/tagged/avconv" class="post-tag" title="show questions tagged 'avconv'" rel="tag">avconv</a> should be redirected to a log file or to /dev/null. Also it should be tested which signal stops <a href="/questions/tagged/avconv" class="post-tag" title="show questions tagged 'avconv'" rel="tag">avconv</a> gracefully. <code>-INT</code> is equivalent to ctrl+c. It it does not work, try <code>-HUP</code>, <code>-TERM</code> or even <code>-KILL</code> if nothing else helps. Maybe You should implement a <code>trap</code> to catch <code>INT</code> signals to kill the last <a href="/questions/tagged/avconv" class="post-tag" title="show questions tagged 'avconv'" rel="tag">avconv</a> it ctrl+c is pressed.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload