From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56891 invoked by alias); 1 Oct 2017 06:40:58 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 56868 invoked by uid 89); 1 Oct 2017 06:40:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=H*F:D*hu, H*Ad:D*hu, works!, crop X-HELO: mail2.informatik.hu Received: from mail2.informatik.hu (HELO mail2.informatik.hu) (81.2.246.242) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 01 Oct 2017 06:40:55 +0000 Received: from mail.informatik.hu (mail.informatik.hu [89.36.219.11]) by mail2.informatik.hu (Postfix) with ESMTPS id CC4F13FA9F for ; Sun, 1 Oct 2017 08:40:52 +0200 (CEST) Received: from [192.168.0.1] (91ECC500.dsl.pool.telekom.hu [145.236.197.0]) (Authenticated sender: szun@informatik.hu) by mail.informatik.hu (Postfix) with ESMTPSA id 714364015E for ; Sun, 1 Oct 2017 08:40:52 +0200 (CEST) To: cygwin@cygwin.com From: Vukovics Mihaly Subject: bash command substitution Message-ID: <8f69ce8f-1092-abdb-e19d-85018ef0c260@informatik.hu> Date: Sun, 01 Oct 2017 06:40:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00000.txt.bz2 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? - Köszönettel: Vukovics Mihály -- 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