Quantcast
Channel: Bash - Removing Linefeed character from a script - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Bash - Removing Linefeed character from a script

$
0
0

I have a script that I've largely finished except for one issue I just can't seem to crack removing a linefeed character before it gets passed to zbarimg. I've tried various things looked around online and can't seem to find anything to get rid of this pesky character. Any help would be greatly appreciated.

#!/bin/bashfolder=~/Publiccdate=$(date +"%Y-%m-%d-%H:%M")inotifywait -m -q -e create -r --format '%:e %w%f' $folder | while read file  do    ifile=$(ls -Art ~/Public | tail -n 1)    ifile2=$(echo $ifile | tr '\n''')    echo $ifile2 >> /tmp/latest.txt    zbarimg $ifile2 | pluma  done

Output of ls -alrt (last few lines)

-rw-r--r--  1 mintux mintux   875988 Nov 11 12:42 20151111_114942.jpg-rw-r--r--  1 mintux mintux   801317 Nov 11 12:45 20151111_114759(2).jpg-rw-r--r--  1 mintux mintux   875988 Nov 11 12:45 20151111_114942(2).jpg-rw-r--r--  1 mintux mintux      911 Nov 23 23:24 nov23.png-rw-r--r--  1 mintux mintux    23158 Nov 23 23:43 nov23a.pngdrwxr-xr-x 73 mintux mintux    24576 Nov 24 08:42 ..drwxr-xr-x  4 mintux mintux     4096 Nov 24 12:10 .

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images