<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: echo with NO new line option in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021478#M97124</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;best is NOT to use 'echo' but the posix shell builting 'print' - this will work across all platforms:&lt;BR /&gt;&lt;BR /&gt;print -n string1 string2&lt;BR /&gt;&lt;BR /&gt;will NOT append a newline.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
    <pubDate>Mon, 08 Jan 2007 08:09:57 GMT</pubDate>
    <dc:creator>Peter Nikitka</dc:creator>
    <dc:date>2007-01-08T08:09:57Z</dc:date>
    <item>
      <title>echo with NO new line option</title>
      <link>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021474#M97120</link>
      <description>Hi everybody!&lt;BR /&gt;&lt;BR /&gt;I have an apparently simple question...but I don't resolve it anyway!&lt;BR /&gt;&lt;BR /&gt;I want to make a simple script:&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;touch file.txt&lt;BR /&gt;echo -n "first line" &amp;gt;&amp;gt; file.txt&lt;BR /&gt;echo "second line" &amp;gt;&amp;gt; file.txt&lt;BR /&gt;&lt;BR /&gt;this script write a file with 2 TWO lines...but I want to write a single line with two different echo command.&lt;BR /&gt;&lt;BR /&gt;I know that echo -n doesn't write the new line at the end of the command but...it does!!&lt;BR /&gt;So...the -n option doesn't work...and even the \n option...so how can I write a single line?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance to anybody!&lt;BR /&gt;&lt;BR /&gt;Emanuele</description>
      <pubDate>Sun, 07 Jan 2007 17:38:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021474#M97120</guid>
      <dc:creator>Emanuele_4</dc:creator>
      <dc:date>2007-01-07T17:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: echo with NO new line option</title>
      <link>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021475#M97121</link>
      <description>Change the code from:&lt;BR /&gt; &lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;touch file.txt&lt;BR /&gt;echo -n "first line" &amp;gt;&amp;gt; file.txt&lt;BR /&gt;echo "second line" &amp;gt;&amp;gt; file.txt&lt;BR /&gt; &lt;BR /&gt;to:&lt;BR /&gt; &lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;touch file.txt&lt;BR /&gt;echo "first line\c" &amp;gt;&amp;gt; file.txt&lt;BR /&gt;echo "second line" &amp;gt;&amp;gt; file.txt&lt;BR /&gt;</description>
      <pubDate>Sun, 07 Jan 2007 18:55:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021475#M97121</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2007-01-07T18:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: echo with NO new line option</title>
      <link>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021476#M97122</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;Hassel suggested very correct. Actually it is correct that you are using -n option, but this option is not working with all the unix environment.&lt;BR /&gt;&lt;BR /&gt;Also if you want to feed extra line, you can use \n option.&lt;BR /&gt;Like&lt;BR /&gt;&lt;BR /&gt;echo "Test \n"&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Nitin</description>
      <pubDate>Mon, 08 Jan 2007 00:05:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021476#M97122</guid>
      <dc:creator>Nitin Kumar Gupta</dc:creator>
      <dc:date>2007-01-08T00:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: echo with NO new line option</title>
      <link>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021477#M97123</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;Hassel suggested very correctly. Actually it is correct that you are using -n option, but this option is not working with all the unix environment.&lt;BR /&gt;&lt;BR /&gt;Also if you want to feed extra line, you can use \n option.&lt;BR /&gt;Like&lt;BR /&gt;&lt;BR /&gt;echo "Test \n"&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Nitin</description>
      <pubDate>Mon, 08 Jan 2007 00:05:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021477#M97123</guid>
      <dc:creator>Nitin Kumar Gupta</dc:creator>
      <dc:date>2007-01-08T00:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: echo with NO new line option</title>
      <link>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021478#M97124</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;best is NOT to use 'echo' but the posix shell builting 'print' - this will work across all platforms:&lt;BR /&gt;&lt;BR /&gt;print -n string1 string2&lt;BR /&gt;&lt;BR /&gt;will NOT append a newline.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Mon, 08 Jan 2007 08:09:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021478#M97124</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-01-08T08:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: echo with NO new line option</title>
      <link>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021479#M97125</link>
      <description>&lt;!--!*#--&gt;Pre-Posix, one way to handle this problem&lt;BR /&gt;was to test "echo" to see how it works:&lt;BR /&gt;&lt;BR /&gt;    echo -n x | grep n &amp;gt; /dev/null&lt;BR /&gt;&lt;BR /&gt;If "-n" works, the status is non-zero.  If&lt;BR /&gt;"-n" does not work, it's zero.&lt;BR /&gt;&lt;BR /&gt;td176&amp;gt; uname -a&lt;BR /&gt;HP-UX td176 B.11.23 U ia64 1928826293 unlimited-user license&lt;BR /&gt;&lt;BR /&gt;td176&amp;gt; echo -n x&lt;BR /&gt;-n x&lt;BR /&gt;td176&amp;gt;&lt;BR /&gt;&lt;BR /&gt;td176&amp;gt; echo -n x | grep n &amp;gt; /dev/null ; echo $?&lt;BR /&gt;0&lt;BR /&gt;&lt;BR /&gt;urtx# sizer -v&lt;BR /&gt;Compaq Tru64 UNIX V5.1B (Rev. 2650); Thu Nov 23 02:10:08 CST 2006&lt;BR /&gt;&lt;BR /&gt;urtx# echo -n x&lt;BR /&gt;xurtx#&lt;BR /&gt;&lt;BR /&gt;urtx# echo -n x | grep n &amp;gt; /dev/null ; echo $?&lt;BR /&gt;1&lt;BR /&gt;&lt;BR /&gt;When your script knows what works, it can&lt;BR /&gt;define an alias or a function to do whatever&lt;BR /&gt;works.  (Years ago, I named mine "echn".)  As&lt;BR /&gt;usual, there are many ways to solve a problem&lt;BR /&gt;like this.&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jan 2007 18:17:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021479#M97125</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2007-01-08T18:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: echo with NO new line option</title>
      <link>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021480#M97126</link>
      <description>As mentioned by everyone else, you are dependent on the scummy C shell.  If you look at echo(1) it says that -n is only supported by the csh builtin and the Berkeley semantics.&lt;BR /&gt;&lt;BR /&gt;A real POSIX shell or echo doesn't support -n.</description>
      <pubDate>Tue, 09 Jan 2007 05:33:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021480#M97126</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-01-09T05:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: echo with NO new line option</title>
      <link>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021481#M97127</link>
      <description>proble resolved with the \c option.&lt;BR /&gt;&lt;BR /&gt;I was wrong because I put the \c out of "".... :-)&lt;BR /&gt;&lt;BR /&gt;Thanks to everybody&lt;BR /&gt;&lt;BR /&gt;Emanuele</description>
      <pubDate>Tue, 09 Jan 2007 11:22:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/echo-with-no-new-line-option/m-p/5021481#M97127</guid>
      <dc:creator>Emanuele_4</dc:creator>
      <dc:date>2007-01-09T11:22:57Z</dc:date>
    </item>
  </channel>
</rss>

