title: How do I correct the shell script to recognize the newline character on another server running Linux?
body: <p>The new-line character is correctly recognized on server2 (Solaris) while it is taken as a <kbd>backslash</kbd><kbd>n</kbd> character on server1 (Linux). How do I correct this?</p>
  
  <p>While working on a simple script that accepts arguments and sends out mails I first noticed this rather odd behavior..</p>
  
  <p>Syntax: <code>$ ksh SEND_MAIL.sh &lt;to&gt; &lt;Subject&gt; &lt;body&gt;</code></p>
  
  <ol>
  <li><p>Now when I run that script on server-1</p>
  
  <p>[kent@server1] $ ksh SEND_MAIL.sh name@site.com "Subject" "123\n456"
  [Thu Jan 10 10:51:18 EST 2013] - Starting to send mail to: name@site.com,
      with the subject \'>>>123\n456\'</p>
  
  <p>Notice that the new-line character is taken as backlash-n.</p></li>
  <li><p>While on server-2 the <code>\n</code> special character correctly expands to a new-line character.</p>
  
  <p>[kent@server2] $ ksh SEND_MAIL.sh name@site.com "Subject" "123\n456"
  [Thu Jan 10 10:51:18 EST 2013] - Starting to send mail to: name@site.com,
      with the subject \'>>>123
  456\'</p></li>
  </ol>
  
  <p>I think I may need to change some KornShell environment variables but I can not figure it out.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>After Henk's guidance below... I see that knowing the difference is not enough in helping me solve main issue - that is to have the script on server1 recognize the <code>\n</code> characters as a new-line. So I have improved my question.</p>
  
  <hr>
  
  <h2><strong>Notes:</strong></h2>
  
  <blockquote>
    <p>Server1 is a Linux server, while Server2 is Solaris.</p>
  </blockquote>
  
  <hr>
  
  <p><strong>Environment details > KornShell:</strong> - As suggested by <em>Henk Langeveld</em></p>
  
  <p>On server1:</p>
  
  <pre><code>[kent@server1]$ ksh --version
    version         sh (AT&amp;T Research) 93t+ 2010-02-02
  [kent@server1]$ echo ${.sh.version}
  bash: ${.sh.version}: bad substitution
  [kent@server1]$ [ "${ERRNO}" ] &amp;&amp; echo ksh88 || echo ksh93
  ksh93
  [kent@server1]$ [ "`echo "\c" | grep c`" ] &amp;&amp; echo ksh93 || echo ksh88 
  ksh93
  </code></pre>
  
  <p>On server2:</p>
  
  <pre><code># I'm am in bash
  [kent@server2]$ ksh --version 
  $
  $ ksh --version
  $ 
  [kent@server2]$ echo ${.sh.version}
  bash: ${.sh.version}: bad substitution
  [kent@server2]$ [ "${ERRNO}" ] &amp;&amp; echo ksh88 || echo ksh93
  ksh93
  [kent@server2]$ [ "`echo "\c" | grep c`" ] &amp;&amp; echo ksh93 || echo ksh88 
  ksh93
  </code></pre>
  
  <hr>
  
  <p>On server 1 &amp; 2 I get the same <em>behavior</em>:</p>
  
  <pre><code>$ echo -e "1\n2"
  1
  2
  $ echo "1\n2"
  1\n2
  $ echo $'1\n2'
  1
  2
  </code></pre>
  
  <hr>
  
  <p><strong>Code:</strong> </p>
  
  <p>SEND_MAIL.sh</p>
  
  <pre><code>#Syntax: $ ksh SEND_MAIL.sh &lt;to&gt; &lt;Subject&gt; &lt;body&gt;
  TO_REC=$1
  SUBJECT=$2
  MESSAGE=$3
  echo "$MESSAGE"| mailx -s "$SUBJECT" $TO_REC
  </code></pre>
  
  <hr>
  
  <p>Putting the line <code>set | grep SH</code> in the script on both the servers to check the shell it is running on as <em>Oliver</em> suggested below.</p>
  
  <p>On server1:</p>
  
  <pre><code>[kent@server1]$ ksh SEND_MAIL.sh kent@123.com "Subject" "&gt;&gt;&gt;123\n\n456$a"
  KSH_VERSION=.sh.version
  SHELL=/bin/bash
  SHLVL=3
  SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
  SSH_CLIENT='3.209.100.144 59645 22'
  SSH_CONNECTION='3.209.100.144 59645 3.56.9.127 22'
  SSH_TTY=/dev/pts/1
  ...
  </code></pre>
  
  <p>On server2:</p>
  
  <pre><code>[kent@server2]$ ksh SEND_MAIL.sh kent@123.com "Subject" "&gt;123\n\n456$a"
  SHELL=/bin/ksh
  SHLVL=1
  SSH_CLIENT='3.209.100.144 49351 22'
  SSH_CONNECTION='3.209.100.144 49351 3.56.29.159 22'
  SSH_TTY=/dev/pts/2
  ...
  </code></pre>