【发布时间】:2017-10-29 19:25:26
【问题描述】:
我有一个名为 DB_DIALECT 的变量,它应该包含一个字符串“org.hibernate.dialect.SQLServerDialect”。该字符串是从 CSV 文件中导出的。
当我尝试打印 DB_DIALECT 内容时
print -r ${DB_DIALECT}
我得到以下输出(最后 3 个字母重复)
org.hibernate.dialect.SQLServerDialect
etc
通过跟踪和错误,我发现这样的事情可以解决问题
print -r ${DB_DIALECT} | sed 's/[[:digit:]]//g'
由于我是 shell 脚本的新手,所以这对我来说没有多大意义。谁能解释一下为什么最后一个字符重复?
我想不通的另一件事是
的输出print -r ${DB_DIALECT} | od -c
这是
0000000 o r g . h i b e r n a t e . d i
0000020 a l e c t . S Q L S e r v e r D
0000040 i a l e c t \n
0000047
t \n
0000053
【问题讨论】:
标签: shell printing scripting ksh