How to display a ' in a script

Post here if you are a new Porteus member and you're looking for some help.
User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

How to display a ' in a script

Post#1 by Ed_P » 25 Jun 2014, 04:33

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.
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: How to display a ' in a script

Post#2 by brokenman » 25 Jun 2014, 11:51

Best practice is:

Code: Select all

echo "Be sure to check the file's properties"
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: How to display a ' in a script

Post#3 by Ed_P » 26 Jun 2014, 04:53

Good to know. Thanks brokenman.
Ed

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: How to display a ' in a script

Post#4 by Ed_P » 29 Jun 2014, 04:07

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."
:)
Ed

Post Reply