| www.delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT sources DOT redhat DOT com |
| Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
| Message-Id: | <4.3.2.7.2.20010114172047.028a1ed0@mail.pacific.net> |
| X-Sender: | jbuff AT mail DOT pacific DOT net |
| X-Mailer: | QUALCOMM Windows Eudora Version 4.3.2 |
| Date: | Sun, 14 Jan 2001 17:27:02 -0800 |
| To: | "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> |
| From: | J H Buffington <jbuff AT pacific DOT net> |
| Subject: | Re: gawk system() problem? |
| In-Reply-To: | <1DAF66E890E7D411828000D0B7912222ED38@MSNLMX01> |
| Mime-Version: | 1.0 |
At 09:45 AM 1/15/01 +1300, Hoyt, Ben wrote:
>I'm using cygwin compiled gawk version 3.0.4 and cannot get the gawk
>system() function to work. I have a file called a.awk with the following
>contents:
>
>BEGIN { print system("dir") }
>
>I then type "gawk -f a.awk" and it prints "0" on the screen but nothing
>else. The "dir" command is not executed. Anyone know why or what to do?
>
>Note: What I actually need to do is create a directory in an awk script. I
>thought I'd be able to do this with system("mkdir mydir"), but as system()
>doesn't (seem to) work that's not very helpful. :-)
"dir" is a builtin of command.com.
If you really want "dir", you'll have to use
BEGIN {system("command /c dir")}
ls (on the other hand) is an external to bash, so you can
say
BEGIN {system("ls -lA")}
As to printing a 0, you do know that system returns the exit
status, not the output of the command, don't you?
--jbuff
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |