The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: Echo behavior
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 02-10-2009
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,965
Quote:
Originally Posted by Saurabh78 View Post
Echo is removing extra blank spaces. See the command.

export INSTALLDIR=”First Second /Two Space”
First off, the two spaces aren't visible unless you put code in code tags. [ code ] stuff [ /code ] without the extra spaces in the tags.

And the reason that the extra space is lost is because the shell splits commands apart on spaces, even if they're a single variable, nothing to do with echo. Your command, without the quotes, amounts to:


Code:
echo "First" "Second "/Two" "space"

You use quotes to tell the shell not to split a string apart.