Piping to another program in the middle of a oneliner
1
vote
1
answer
257
views
I'm trying to create a simple bash one line script that allows me to pick a particular barcode that's visible on my screen and make it available as text on my clipboard. To that effect, I wrote a bash script that aims to capture a part of the screen with
gnome-screenshot
into a PNG file, inspect that file with zbarimg
and make whatever it outputs available to be pasted with xclip
.
Here's what I wrote:
tfile=$(mktemp -u -p ~).png && gnome-screenshot -a -f $tfile && zbarimg -q --raw $tfile | xclip; rm $tfile
Just after I run this script it does request me to capture a part of the screen (exactly what gnome-screenshot
is supposed to do), the screenshot file is created, but after that it seems that xclip
runs and waits for input forever, as if zbarimg
didn't output anything.
Does anyone have a suggestion to solve this issue?
Asked by Ramiro
(131 rep)
Jan 26, 2018, 07:44 PM
Last activity: Oct 15, 2022, 07:58 AM
Last activity: Oct 15, 2022, 07:58 AM