开发者

ksh + print the same format as param

the following script print the $line parameter my target is to print the numbers in the $line exactly as they described as the following

example1

   12435345645645645
   6564564564565
   655656565

But the script print like that

12435开发者_如何学运维345645645645 6564564564565 655656565

What need to change in the script in order to get the print as example1 (without to change $line parameter)

the scrip.ksh

 #!/bin/ksh


 line=' 12435345645645645
        6564564564565
        655656565'

print $line

./script.ksh

 12435345645645645 6564564564565 655656565


Put quotes around the variable to preserve the newlines:

print "$line"


need to add "\n" on the end of the line

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜