This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Portable shell code between Cygwin and Linux


On 08/07/2011 07:20 PM, Sven Köhler wrote:
pathconvert() {
   echo "$1"
}


(There's one issue here: I would like to write echo -- "$1", but echo
doesn't understand --. Bummer.)

echo _cannot_ be used to portably echo arbitrary strings. For that, you need printf:


pathconvert() {
  printf '%s\n' "$1"
}

--
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]