I want to use zbarcam but after reading the barcode it doesn't stop.
$ zbarcam | xvkbd -file - -window emacs EAN-13:6941428130969 CODE-128:3096140900557
Do you know how I can tell bash to kill zbarcam after printing to stdout first \ n?
Try
tmp=/tmp/barcode.$$ # Note: security risk zbarcam > $tmp & pid=$! # Sleep until file has content while [[ ! -s $tmp ]] ; do sleep 1 done kill $pid cat $tmp
Note that this may not work if zbarcam does not flush its output.
Have you tried this?
zbarcam | head -1 | xvkbd -file - -window emacs