delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/10/02/08:24:23

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:content-type
:content-transfer-encoding:date:from:to:subject:in-reply-to
:references:message-id; q=dns; s=default; b=izjSwF5uH3/0yjtCCXSV
fXDRspF+dXXQCAhB63kC2RRmXNDuIbnyMSLJ5MCvdrVqc+PL/EAzRlksTY8Jf35X
XuXeHkcPfYNT9s5kcEJ/ykjkL8XRa1S1/Z3gePG/Y9j6LtayNbohBkHlRYNUR8i6
FbqLMD8dogdNy6hSWRapEu8=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:content-type
:content-transfer-encoding:date:from:to:subject:in-reply-to
:references:message-id; s=default; bh=NxtxBrv3rgIUcXoLuRwwdDMBYh
Q=; b=Pt7TSKnXyhs3MEF44v/J+dzv8pFHEnkP2Ptf/KjlghJImGH68M5/SMJX43
LkY8wjcWTDnwawTMKGPcwn58N1jGgT+1rMPdH7vyaiPL8ARdUtD8deR4KZ1KukOv
mGbiZqc/TRSImXpxtT3YDb8IRNskTFEP7EFAx008AnoR0Hxhc=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Mihaly, mihaly, inglis, Inglis
X-HELO: mail2.informatik.hu
MIME-Version: 1.0
Date: Mon, 02 Oct 2017 14:23:29 +0200
From: =?UTF-8?Q?Vukovics_Mih=C3=A1ly?= <vm AT informatik DOT hu>
To: cygwin AT cygwin DOT com
Subject: Re: bash command substitution
In-Reply-To: <530cc7d7-b5cb-f840-887b-a46c0f5c6bd5@SystematicSw.ab.ca>
References: <8f69ce8f-1092-abdb-e19d-85018ef0c260 AT informatik DOT hu> <530cc7d7-b5cb-f840-887b-a46c0f5c6bd5 AT SystematicSw DOT ab DOT ca>
Message-ID: <c7cb80cf2d531452aba7035b3008ddeb@informatik.hu>
X-Sender: vm AT informatik DOT hu
User-Agent: Roundcube Webmail/1.3.0
X-IsSubscribed: yes
Note-from-DJ: This may be spam

Hello,

it was compiled with mingw, and the \r was the issue, thanks!

---
Köszönettel:
Vukovics Mihály

On 2017-10-01 19:54, Brian Inglis wrote:
> On 2017-10-01 00:40, Vukovics Mihaly wrote:
>> 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?
> 
> Non-numeric characters in string - add "| cat -A" to the end of your 
> pipe,
> or equivalent od or xxd commands to see what's there.
> There is no Cygwin package so how was ffprobe built - with Cygwin or 
> Mingw?
> May be extraneous trailing spaces or \r at end of input - try "set -o 
> igncr".

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019