Page 1 of 1

How to display a ' in a script

Posted: 25 Jun 2014, 04:33
by Ed_P

Code: Select all

echo Be sure to check the file's properties.
Results in a bash

Code: Select all

unexpected EOF while looking for matching `''

error. Is there a hex code that needs to be used?


-update-

Got it

Code: Select all

echo Be sure to check the file\'s properties.

Re: How to display a ' in a script

Posted: 25 Jun 2014, 11:51
by brokenman
Best practice is:

Code: Select all

echo "Be sure to check the file's properties"

Re: How to display a ' in a script

Posted: 26 Jun 2014, 04:53
by Ed_P
Good to know. Thanks brokenman.

Re: How to display a ' in a script

Posted: 29 Jun 2014, 04:07
by Ed_P
Quotes work for echos with "&"s in them also. :good:

Code: Select all

echo "Set Time Zone to US/Eastern to correct Date & Time for saved files."
:)