For Programmers: Free Programming Magazines  


Home > Archive > AWK > March 2004 > exec in AWK









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author exec in AWK
Igor Bukanov

2004-03-19, 8:23 pm

Hi!

Does AWK has some analog of shell's exec? I have a shell script that
effectively just wraps an AWK script to setup an environment for a
program and then calls exec on that program. So if AWK would support
exec I would just drop the shell completely.

Any hints?

Thanks in advance, Igor
Michael Heiming

2004-03-19, 8:23 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Igor Bukanov <igor@fastmail.fm> wrote:
> Hi!


> Does AWK has some analog of shell's exec? I have a shell script that
> effectively just wraps an AWK script to setup an environment for a
> program and then calls exec on that program. So if AWK would support
> exec I would just drop the shell completely.


> Any hints?


Depends on your awk version and *nix system:

- From 'man awk' (GNU awk) on my box:

system(cmd-line) Execute the command cmd-line, and return the exit
status.
(This may not be available on non-POSIX sys-tems.)

Checking the man page on your box and testing should show.

- --
Michael Heiming (GPG-Key ID: 0xEDD27B94)

Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of spam.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAQjo3AkPEju3Se5QRAsMAAKCOntjRo1gT
UBzmJFGnFauILBn8BQCcCcxM
T5AmSHBkBAFbC2zikYk4djM=
=iVuN
-----END PGP SIGNATURE-----
Igor Bukanov

2004-03-19, 8:23 pm

Michael Heiming <michael+USENET@www.heiming.de> wrote in message news:<pndt1c.uj5.ln@news.heiming.de>...
> Depends on your awk version and *nix system:
>
> - From 'man awk' (GNU awk) on my box:
>
> system(cmd-line) Execute the command cmd-line, and return the exit
> status.
> (This may not be available on non-POSIX sys-tems.)
>


But system is not exec: I do not want to have an additional awk
process to wait until system returns, I would like to replace the
current process image with another one exectly as execl etc. system
calls would do.

It seems that for now I have to stick with shell+awk :(.

Regards, Igor
Kenny McCormack

2004-03-19, 8:23 pm

In article <7f487643.0402291617.14868cd7@posting.google.com>,
Igor Bukanov <igor@fastmail.fm> wrote:
....
>But system is not exec: I do not want to have an additional awk
>process to wait until system returns, I would like to replace the
>current process image with another one exectly as execl etc. system
>calls would do.
>
>It seems that for now I have to stick with shell+awk :(.
>
>Regards, Igor


Write a gawk extension library.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com