Problem with command substitution in mksh shell after upgrading to Cygwin 1.7.26

PRIKHODKO, GEORGE gp1865@att.com
Wed Dec 4 03:24:00 GMT 2013


Hi,

After upgrading to Cygwin to 1.7.26 the commands:

print $(getIP)
print $(ipconfig | grep "IPv4 Address" | sort | head -1 | cut -d ":" -f 2 \
    | sed -e "s/ *\\([0-9.]*\\).*/\\1/")

in the following script

#!/usr/bin/ksh

cv=$(uname -r)
cv=${cv%\(*}
cygcheck -s -v -r > cygcheck_$cv.out

exec > test_$cv.log 2>&1
set -xv

getIP() {
    ipconfig | grep "IPv4 Address" | sort | head -1 | cut -d ":" -f 2 \
        | sed -e "s/ *\\([0-9.]*\\).*/\\1/" 
}
#
# the following four commands should print IP address 4 times
#
getIP

print $(getIP)

ipconfig | grep "IPv4 Address" | sort | head -1 | cut -d ":" -f 2 \
    | sed -e "s/ *\\([0-9.]*\\).*/\\1/"

print $(ipconfig | grep "IPv4 Address" | sort | head -1 | cut -d ":" -f 2 \
    | sed -e "s/ *\\([0-9.]*\\).*/\\1/")

exit

started to produce incorrect results.
test_1.7.26.log shows instead of IP address a whole output of ipconfig is printed for these lines.

/usr/bin/ksh, used in the script, is a symbolic link to /usr/bin/mksh

Please, let me know if you need more info to research the problem.

Thanks,
George

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck_1.7.25.out
Type: application/octet-stream
Size: 146586 bytes
Desc: cygcheck_1.7.25.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20131204/86738582/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck_1.7.26.out
Type: application/octet-stream
Size: 146586 bytes
Desc: cygcheck_1.7.26.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20131204/86738582/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_1.7.25.log
Type: application/octet-stream
Size: 954 bytes
Desc: test_1.7.25.log
URL: <http://cygwin.com/pipermail/cygwin/attachments/20131204/86738582/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_1.7.26.log
Type: application/octet-stream
Size: 6670 bytes
Desc: test_1.7.26.log
URL: <http://cygwin.com/pipermail/cygwin/attachments/20131204/86738582/attachment-0003.obj>
-------------- next part --------------
--
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


More information about the Cygwin mailing list