Programming, for all ages and all languages.
-
Neo
- Member
- Posts: 842
- Joined: Wed Oct 18, 2006 9:01 am
Post
by Neo »
Ho do i get the echo command to echo double-quotes (""). I tried the command
but got \042 echoed in the CSH.
How is this done?
Only Human
-
distantvoices
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
-
Contact:
Post
by distantvoices »
provided you use the gnu-unix echo, this works like this:
you simply hide the quotes with a backslash from being parsed/interpreted by echo.
the dos/windows echo just outputs what you give it, so it is pretty ok to issue echo " " " " in the dos box.
-
Neo
- Member
- Posts: 842
- Joined: Wed Oct 18, 2006 9:01 am
Post
by Neo »
That does not work in csh only i bash.
Only Human
-
distantvoices
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
-
Contact:
Post
by distantvoices »
reliant unix echo with csh:
this issues: " " " "
-
mystran
Post
by mystran »
Code: Select all
<08:24:41|mystran@teemu:~>$ tcsh
teemu ~ > echo ' " foobar " '
" foobar "
In bash, either the above, or \" escaping works.
-
Neo
- Member
- Posts: 842
- Joined: Wed Oct 18, 2006 9:01 am
Post
by Neo »
beyond infinity wrote:
reliant unix echo with csh:
this issues: " " " "
And if the text has single quotes in it too...?
Only Human
-
Candy
- Member
- Posts: 3882
- Joined: Tue Oct 17, 2006 11:33 pm
- Location: Eindhoven
Post
by Candy »
What about telling echo to interpret them?
-
Neo
- Member
- Posts: 842
- Joined: Wed Oct 18, 2006 9:01 am
Post
by Neo »
@candy: so it has to be in double quotes eh?
Thanks a lot anyway folks.
Only Human
-
Candy
- Member
- Posts: 3882
- Joined: Tue Oct 17, 2006 11:33 pm
- Location: Eindhoven
Post
by Candy »
Neo wrote:
@candy: so it has to be in double quotes eh?
Thanks a lot anyway folks.
No, you need the -e. Otherwise it plain prints it, this way it interprets the \-stuff.