This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bash command substitution


On 01/10/2017 08:40, Vukovics Mihaly wrote:
Hello All,


I just wanted to use my bash script written in Debian 8 in cygwin(latest, win10 64bit), but does not work. At a specific line there is a command substitution trying to get result from ffprobe:

VHEIGHT=$(ffprobe -v error -show_entries stream=width,height -of default=noprint_wrappers=1 ${OLDFILE} | grep "height" | cut -f2 -d'=')

For debugging purpose the same command is executed without putting the result into a variable, and works! Does anyone know why is it not working in cygwin?

Code:

...
declare -i VHEIGHT
ffprobe -v error -show_entries stream=width,height -of default=noprint_wrappers=1 ${OLDFILE} | grep height | cut -f2 -d'=' VHEIGHT=$(ffprobe -v error -show_entries stream=width,height -of default=noprint_wrappers=1 ${OLDFILE} | grep "height" | cut -f2 -d'=')
...

Here is some debug log (set -x):

....
+ declare -i VHEIGHT
+ ffprobe -v error -show_entries stream=width,height -of default=noprint_wrappers=1 P1220312.MP4
+ grep height
+ cut -f2 -d=
2160              # this woudl be the desired value
+ VHEIGHT=        # here the variable is empty!
+ VIDSTABDETECTOPTS=:shakiness=10
+ VIDSTABDETECTOPTS+=:result=P1220312-stab.trf
+ VIDSTABTRANSFORMOPTS+=:crop=keep

....

The same in Linux bash:

...
+ declare -i VHEIGHT
+ ffprobe -v error -show_entries stream=width,height -of default=noprint_wrappers=1 P1220312.MP4
+ grep height
+ cut -f2 -d=
2160
++ ffprobe -v error -show_entries stream=width,height -of default=noprint_wrappers=1 P1220312.MP4
++ grep height
++ cut -f2 -d=
+ VHEIGHT=2160     # here is the desired value in the variable!!!
...

Any suggestions?


from where ffprobe is coming for ?

 $ cygcheck -p ffprobe
Found 0 matches for ffprobe

If it is a windows program, may it is due to CRLF emitted instead of LF



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]