When I pass this command from my script:
transmission-remote -n 'transmission:transmission' -l | awk '{ s = ""; for (i = 10; i <= NF; i++) s = s $i " "; print s }' | grep "\b\b" | tail -1
Result:
Micro Pratique N°247 Avril 2017.pdf
But when I pass this command in my script and put the result in a variable like this:
test=`transmission-remote -n 'transmission:transmission' -l | awk '{ s = ""; for (i = 10; i <= NF; i++) s = s $i " "; print s }' | grep "\b\b" | tail -1`
The result is not the same! Here is the script with "set -x":
++ test='Pratique N°247 Avril 2017.pdf '
Why does it shorten my first word "Micro"?
Here is the result transmission-remote -n transmission:transmission -l:
ID Done Have ETA Up Down Ratio Status Name
1 100% 8.30 GB Done 1.0 0.0 2.8 Seeding Ghost In The Shell 2 Innocence 2003 MULTi VFF BluRay 1080p AC3 x264
65 100% 4.86 GB Done 0.0 0.0 2.9 Idle WWE.RAW.2017.03.20.720p.HDTV.x264-Ebi.mp4
71 100% 2.89 GB Done 0.0 0.0 2.9 Idle WWE.Smackdown.Live.2017.03.21.720p.HDTV.x264-Ebi.mp4
106 100% 4.80 GB Done 0.0 0.0 0.0 Seeding WWE.RAW.2017.03.27.720p.HDTV.x264-Ebi.mp4
107 100% 2.90 GB Done 0.0 0.0 0.9 Idle WWE.SmackDown.Live.2017.03.28.720p.HDTV.x264-NWCHD.mp4
113 0% None Unknown 0.0 0.0 None Idle Micro Pratique N°247 Avril 2017.pdf
Sum: 23.75 GB 1.0 0.0
source
share