No Next Item No Next Conference Can't Favor Can't Forget Item List Conference Home Entrance    Help
View Responses


Grex Info Item 282: Sending special characters with "tel"
Entered by ajax on Wed Apr 10 19:25:13 UTC 1996:

  I have a question about the "tel" program, and can't find a man page
for it on Grex.  It seems like most of the messages I want to send have
characters I can't send.  Like if I want to say "type 1,$p to list your
file," the $ makes it say "p: undefined variable."  I assume the shell
is doing some extra processing on the command-line, but how do I let it
know I really want a $ there?  I've tried \ but it doesn't help.  Also,
is there a way to send quotation marks within a tel message?

15 responses total.



#1 of 15 by davel on Thu Apr 11 01:26:51 1996:

Well, this seemed to work for me.  I'd guess quotes can be managed the
same way:
> /home/davel$ tel davel 'this is a test $p'
> Telegram to davel on ttyh8...Telegram from davel on ttyh8 at 21:24 ...
> this is a test $p
> SENT
> EOF (davel)


#2 of 15 by remmers on Thu Apr 11 10:43:45 1996:

Right - single quotes escape shell metacharacters such as $.
So does preceding the character with a backslash. (Dunno why
that didn't work for Rob.) Single quotes protect double quotes
and vice versa. Double quotes don't escape shell metacharacters.
As an exercise, compare the following:

        tel ajax E.T. phone $HOME
        tel ajax E.T. phone \$HOME
        tel ajax 'E.T. phone $HOME'
        tel ajax "E.T. phone $HOME"



#3 of 15 by popcorn on Thu Apr 11 14:06:43 1996:

This response has been erased.



#4 of 15 by ajax on Thu Apr 11 18:47:01 1996:

Aha, thanks for the multiple solutions.  John, the thing I was doing was
  tel ajax "E.T. phone \$HOME"
which interprets the \ literally, and the $ as an environment variable.


#5 of 15 by remmers on Thu Apr 11 19:22:24 1996:

Does tel check for control-characters or limit the number of
characters that it will send to the recipient? If not, you
could do some very nasty things with tel, such as

                tel ajax "`cat homongous-file`"



#6 of 15 by remmers on Thu Apr 11 19:23:13 1996:

(Not to mention "tel-bombs".)


#7 of 15 by popcorn on Fri Apr 12 06:30:10 1996:

This response has been erased.



#8 of 15 by davel on Fri Apr 12 11:04:02 1996:

Hmm.  When I just tested it, linefeeds were *not* stripped.  The output looked
exactly the same as it did not passed through tel.


#9 of 15 by popcorn on Fri Apr 12 13:56:55 1996:

This response has been erased.



#10 of 15 by davel on Fri Apr 12 14:20:05 1996:

Weird.  I just ran it with exactly the same command, & it didn't behave the
same.
Forget I ever said anything.  <looks for hole to crawl into>


#11 of 15 by draven on Sun Apr 21 01:41:33 1996:

The size limit for tel is 1024 bytes.  Certainly enough for any sane message.

   The line feed problem is caused by the differences between csh and sh 
family shells, although I thought you needed double quotes around the 
command substitution.  Such as:

tel popcorn "`cat hi`"

In csh, the line feeds are removed by the command substitution.
In sh, they're removed when it's broken into arguments.  Since the quoted 
section is only one argument, the line feeds are not removed.

At least, that's what I've found from personal experience (I haven't 
actually analyzed the source code).


#12 of 15 by davel on Sun Apr 21 17:47:49 1996:

Hmm.  Thanks, Brian, that would indeed explain the difference I found.  I'd
presume that tel concatenates its arguments with spaces, but surely it
wouldn't break down any one argument that might contain linefeeds.  (I use
bash, which is sh-like.)


#13 of 15 by popcorn on Tue Apr 23 13:45:46 1996:

This response has been erased.



#14 of 15 by remmers on Wed Apr 24 12:40:26 1996:

Backquoting has been around from the early days of Unix and goes
back at least to AT&T 6th Edition Unix (mid-1970's?) Bourne shell.
It's a standard feature of all shells.


#15 of 15 by draven on Fri Apr 26 16:42:11 1996:

Try this instead:
  tel popcorn "`head -10 /etc/passwd`"

Leaving it out of quotes causes causes the shell to break it down into 
words, replacing line feeds, tabs, and multiple spaces with single spaces.

Response not possible - You must register and login before posting.

No Next Item No Next Conference Can't Favor Can't Forget Item List Conference Home Entrance    Help

- Backtalk version 1.3.30 - Copyright 1996-2006, Jan Wolter and Steve Weiss