can exec pass an argument starting by < 
Author Message
 can exec pass an argument starting by <

Hello,

Todd David Ruddick sent this message to comp.lang.tcl in 1995:

Quote:
>  I'm trying to use exec to start a program with arguements...
>  The problem is, the first arg., which is in a tcl variable, may begin
>  with any character--and often begins with <...

>  I can't figure out how to make exec not treat the arguement as a
>  request for redirection.. Can anybody help me??

I have exactly the same problem : I want to write something like this:

exec gvim --remote-send <Esc>

the gvim program takes 2 arguments : the first is --remote-send , and the
second is the string <Esc>
The error message I receive is;
couldn't read file "Esc>": no such file or directory.

Thank you for your help.
    Adrian.



Fri, 09 Apr 2004 02:34:39 GMT  
 can exec pass an argument starting by <

Quote:

> [re: exec gvim --remote-send <Esc> ]

>Quoting appropriately values being shipped to a command being invoked via
>a shell is typically pretty {*filter*} stuff.  Seems to me that it would really
>be worthwhile if someone would share in tcllib a proc that takes care of
>as much of this sort of thing as possible...

Fortunately, [exec] doesn't invoke a subshell.  It executes
the subprocess directly, so that layer of quoting hell is
avoided.

Unfortunately, [exec] does its own layer of argument processing
for arguments beginning with <, >, |, and 2>, and there is *no way*
to quote these magic characters from [exec].

--Joe English




Fri, 09 Apr 2004 22:45:51 GMT  
 can exec pass an argument starting by <
On [22 Oct 2001 14:45:51 GMT],

Quote:


>> [re: exec gvim --remote-send <Esc> ]

>Fortunately, [exec] doesn't invoke a subshell.  It executes
>the subprocess directly, so that layer of quoting hell is
>avoided.

>Unfortunately, [exec] does its own layer of argument processing
>for arguments beginning with <, >, |, and 2>, and there is *no way*
>to quote these magic characters from [exec].

Unless you specify a subshell, and it's proper quoting:
    set filename {<ESC>}
    exec sh -c "gvim --remote-send '$filename'"

--
Glenn Jackman



Fri, 09 Apr 2004 23:34:06 GMT  
 can exec pass an argument starting by <

Quote:
>:exec gvim --remote-send <Esc>

>Quoting appropriately values being shipped to a command being invoked via
>a shell is typically pretty {*filter*} stuff.  Seems to me that it would really
>be worthwhile if someone would share in tcllib a proc that takes care of
>as much of this sort of thing as possible...  It might even be nice to roll
>this kind of thing into the core if it were cross platform.

Some thoughts about this problem with exec have been collected in the Wiki:
    http://www.*-*-*.com/ ;[AlternativeToExec]

yes, it would be nice.



Sat, 10 Apr 2004 20:39:00 GMT  
 can exec pass an argument starting by <

Quote:


> >:exec gvim --remote-send <Esc>

> >Quoting appropriately values being shipped to a command being invoked via
> >a shell is typically pretty {*filter*} stuff.  Seems to me that it would really
> >be worthwhile if someone would share in tcllib a proc that takes care of
> >as much of this sort of thing as possible...  It might even be nice to roll
> >this kind of thing into the core if it were cross platform.

> Some thoughts about this problem with exec have been collected in the Wiki:
>     http://www.*-*-*.com/ ;[AlternativeToExec]

> yes, it would be nice.

Here's a solution to the example used in the Wiki
(pasted here)
Example:
 % exec  /bin/echo "<hallo>"
 couldn't read file "hallo>": no such file or directory
 %
(end paste)

One solution:
 % exec /bin/echo -e \\74hallo\\76
 <hallo>
 %

This works because of the -e option to echo.  I don't know about the
portability of the -e option, or if this is of any use to the
original post, but I thought it might point somebody in the right
direction.  If anything, it will help those trying to use "exec echo" with
redirection characters on Linux.



Sat, 17 Apr 2004 09:21:14 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Arguments to exec with '<'

2. Difference in exec argument passing at Tcl/Tk 8.4

3. arguments passing with exec

4. passing arguments to "exec"

5. How to pass arguments to program been exec'ed

6. Porblems passing command line arguments to exec

7. ADVICE <<<<<<<<<<<<<<<<<<<-----------EASY ---------------

8. passing functions with variable number of arguments as procedure arguments

9. Requiring arguments to be passed as keyword arguments

10. exec, "<<" and binary data

11. I SEARCH ASSEMBLER CODERS <<<<<<<<<<<<

12. Fortran compiler source code <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

 

 
Powered by phpBB® Forum Software