|
|
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.
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)
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"
This response has been erased.
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.
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`"
(Not to mention "tel-bombs".)
This response has been erased.
Hmm. When I just tested it, linefeeds were *not* stripped. The output looked exactly the same as it did not passed through tel.
This response has been erased.
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>
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).
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.)
This response has been erased.
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.
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.
|
|
- Backtalk version 1.3.30 - Copyright 1996-2006, Jan Wolter and Steve Weiss