This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Using 'test' fails when referencing home '~' from bash loop
- From: Steven Penny <svnpenn at gmail dot com>
- To: matt at codespunk dot com, cygwin at cygwin dot com
- Date: Mon, 10 Jun 2013 19:52:06 -0500
- Subject: Re: Using 'test' fails when referencing home '~' from bash loop
From: "Matt D."
> The following never exits the loop:
> until test -f "~/file.txt"; do sleep 1 && echo sleep; done; echo done
This is not an error, or even Cygwin related. With Bash you must now quote "~"
if you want it to expand.
Do this
[ -f ~/file.txt ]
or this
[ -f ~'/file.txt' ]
or this
[ -f "$HOME/file.txt" ]
--
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