tcl question: Exec
Roger Oberholtzer
roger
Mon May 17 11:57:30 PDT 2004
In your examples, you never told exec what to run. It would be looking
for a command called '[' somewhere in your path. '[' is the shell's
builtin version of the 'test' command. So, you would really want to be
running 'test', not 'sh' or '['.
As I wrote in another post, use the tcl 'file' command to manipulate
files and directories. It saves lots of headache. No need to exec a
command.
On Sun, 2003-12-28 at 22:08, Joel Hammer wrote:
> I want to test if a file exists using tcl by calling linux (bash) functions.
>
> These commands give the following:
>
> ======================
> set d [ exec echo OK]
> This sets d to OK
> ======================
>
> =====================================
> set d 0
> set d [ exec \[ -e /home/jlh/junk \] ]
> The second command resets d to null.
> ======================================
>
> ================================================
> set d [ exec \[ -e /home/jlh/junk \] && echo OK ]
> This command fails with a missing bracket error.
> =================================================
>
> I would like to know why the last command fails.
>
> Any insight appreciated,
>
> Joel
>
> _______________________________________________
> Linux-users mailing list
> Linux-users at smtp.linux-sxs.org
> Unsubscribe/Suspend/Etc -> http://smtp.linux-sxs.org/mailman/listinfo/linux-users
>
More information about the Linux-users
mailing list