how to echo the '

Derek R. Foster dfoster at jarthur.Claremont.EDU
Wed Mar 20 14:56:17 AEST 1991


Someone whose name seems to have gotten lost wrote:
>	OK, in csh, I want to have this string echo'd...     ^[=@'^[H8
>	Problem being, I can't get the ' to be echo'd.
>	(I am putting this command into a shell script.)
>	If I use the command...
>
>	echo '=@'H8'
>
>	...it thinks the string to be echo'd ends at the second '
>	If I use the command...
>	echo '=@\'H8'
>
>	...it sees the \ as a character
>

To echo a string like   abc'def
  use the format
  echo 'abc'\''def'

This is read as:
  a string, 'abc'
  an escaped quote character, \' which will not be interpreted like a
  normal quote character by the shell,
  another string, 'def'

In your case, this becomes:
  echo '=@'\''H8'

I hope this helps!

Derek Riippa Foster



More information about the Comp.unix.shell mailing list