www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/10/01/13:55:03

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:from:subject:reply-to:to:references:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=rfUsahxMhTau31UV
UcOdS/RXMExF+4s8aKdNELQz8fQeGO3i9RPH7jIqnjLCmxFKNJ/ebnaDihbx3d7R
YxaVtF5s1CpHgusNw8CJGmjXE7IQsJift6TUbqtsvXGoVEIDFXrIhg3qQQDgdtXJ
WVwasm2Txv9VjSXWjfD2bUIsEyE=
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:from:subject:reply-to:to:references:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=k7LOVLDuFmB7rQxEvZAb+Y
aA2ek=; b=oFDCIZHMdl610dP2n1iuktVk9B/LTx/Lbqut0D0L/4PftoDIynRG5e
PY8qEZZ2YJ898L+G5eE7/QizzRh/R3UmmCSCFRIElinZ5mI7WPunmYwk7vukKaHD
0+CChgAAFAJjA7aF47/ydrC+Igd0BliF6CJp5wZzbM5Ndt90hReI4=
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=0.5 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*R:D*ca, Canada, canada, calgary
X-HELO: smtp-out-no.shaw.ca
X-Authority-Analysis: v=2.2 cv=HahkdmM8 c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=IkcTkHD0fZMA:10 a=wn2tWnfOKRrLvmu7J_sA:9 a=QEXdDO2ut3YA:10
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Subject: Re: bash command substitution
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
To: cygwin AT cygwin DOT com
References: <8f69ce8f-1092-abdb-e19d-85018ef0c260 AT informatik DOT hu>
Message-ID: <530cc7d7-b5cb-f840-887b-a46c0f5c6bd5@SystematicSw.ab.ca>
Date: Sun, 1 Oct 2017 11:54:40 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0
MIME-Version: 1.0
In-Reply-To: <8f69ce8f-1092-abdb-e19d-85018ef0c260@informatik.hu>
X-CMAE-Envelope: MS4wfMxcP8CVBmFcwDYBu/f8rqHJ/u1QfHST8h+AJMnvhze2bQZu6fa+o0OlNS+yg+Wv+C9MFOBwdIvRJAWwfsKtQCi9tWdnEyzCms+dz+uBhAyHAIgA5qn4 8WuEebcYPjQ94urH7pcsgMeXsYjJnONZ6t2rbDOr+0EgWRLfDAzm15mO0GZFOsrT2l5b6OEkNrYEaA==
X-IsSubscribed: yes
Note-from-DJ: This may be spam

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

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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