作为IFS的传输结束字符

时间:2016-08-18 15:09:06

标签: sh

我有一个Bourne shell脚本,它使用End-of-Transmission字符作为IFS:

read

EOT如何表现为IFS?或者var xml1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><foo:NameHent xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:foo1=\"http://sample.com\" xmlns:foo=\"http://example.com\"><foo1:Firstname>John</foo1:Firstname><foo1:Firstname>Michael</foo1:Firstname><foo1:Lastname>Doe</foo1:Lastname><foo1:Date>1988-03-05</foo1:Date></foo:NameHent>"; XmlSerializer xmlSerializer = new XmlSerializer(typeof(NameHent)); NameHent c = xmlSerializer.Deserialize(new StringReader(xml1)) as NameHent; public class NameHent { [XmlElement(Namespace = "http://sample.com")] public string [] Firstname; [XmlElement(Namespace = "http://sample.com")] public string Lastname; [XmlElement(Namespace = "http://sample.com")] public string Date; [XmlNamespaceDeclarations] public XmlSerializerNamespaces xmlns = new XmlSerializerNamespaces(); public NameHent() { xmlns.Add("foo", "http://example.com"); xmlns.Add("foo1", "http://sample.com"); } } 期望什么样的输入?

1 个答案:

答案 0 :(得分:1)

它是一个ASCII字符,就像,一样;它只是不可打印。

$ printf 'foo\004bar' > tmp.txt
$ hexdump -C tmp.txt
00000000  66 6f 6f 04 62 61 72 0a                           |foo.bar.|
00000008
$ IFS=$(printf '\004') read f1 f2 < tmp.txt
$ echo "$f1"
foo
$ echo "$f2"
bar