[Swift-devel] single quotes in arg
Ketan Maheshwari
ketan at mcs.anl.gov
Mon Feb 10 12:56:20 CST 2014
Hi,
A user reported that Swift was not recognizing single quotes within the
text of a commandline arg. I was able to reproduce the issue:
Swift source (printargs.swift) :
string anarg=@arg("filter_cmd");
trace(anarg);
$ swift printargs.swift -filter_cmd="'hello' world"
Progress: time: Mon, 10 Feb 2014 12:47:41 -0600
SwiftScript trace: hello world
Escape chars do not work:
$ swift printargs.swift -filter_cmd=" \'hello\' world"
/Users/ketan/swift-0.94/cog/modules/swift/dist/swift-svn/bin/swift: eval:
line 177: unexpected EOF while looking for matching `''
/Users/ketan/swift-0.94/cog/modules/swift/dist/swift-svn/bin/swift: eval:
line 178: syntax error: unexpected end of file
Single quotes in the outer string do not work:
$ swift printargs.swift -filter_cmd=' 'hello' world'
Progress: time: Mon, 10 Feb 2014 12:49:59 -0600
SwiftScript trace: hello world
Outer single quotes and inner double quotes seem to be working:
$ swift printargs.swift -filter_cmd=' "hello" world'
Progress: time: Mon, 10 Feb 2014 12:51:40 -0600
SwiftScript trace: "hello" world
A single single quote does not work:
swift printargs.swift -filter_cmd=" he'llo world"
/Users/ketan/swift-0.94/cog/modules/swift/dist/swift-svn/bin/swift: eval:
line 177: unexpected EOF while looking for matching `''
/Users/ketan/swift-0.94/cog/modules/swift/dist/swift-svn/bin/swift: eval:
line 178: syntax error: unexpected end of file
In summary, it seems impossible to pass single quote character (') to Swift
commandline arg values.
Thanks,
Ketan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20140210/52fa1251/attachment.html>
More information about the Swift-devel
mailing list