How to display a ' in a script

Post here if you are a new Porteus member and you're looking for some help.
Post Reply
User avatar
Ed_P
Contributor
Contributor
Posts: 3403
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit 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: 5652
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

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: 3403
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit 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: 3403
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit 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