bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Strange no-print error (user script regression)


From: arnold
Subject: Re: [bug-gawk] Strange no-print error (user script regression)
Date: Tue, 17 Apr 2018 03:07:03 -0600
User-agent: Heirloom mailx 12.4 7/29/08

Hi.

I suspect that Neil's solution is right on target, and isn't
something I would have thought about.

Also - check that you are using the return value of system() correctly; see
https://www.gnu.org/software/gawk/manual/html_node/I_002fO-Functions.html .

Thanks!

Arnold

"Neil R. Ormos" <address@hidden> wrote:

> address@hidden wrote:
>
> > Until recently I was using a Gentoo linux system
> > [...] [but I am now] using Devuan ASCII Linux.
>
> > [...] The shell is bash on both systems.
>
> > I had an awk script for spitting out the urls of
> > package files I needed to download and, with a
> > path change, it should have worked quite well.
>
> > [...]
> > c = system("test -s \"/var/cache/apt/archives/" a[ret] "\"
> > &> /dev/null");
> > [...]
>
> > [output is wrong]
>
> > Until I remove this part on line 13: "&> /dev/null".
> > Then my script works fine. [...]
> > What is going on?
>
> > % echo $SHELL
> > /bin/bash
>
> Although your $SHELL is bash, the shell being run
> from gawk's system() function may be something
> else.  Have you checked which shell is being run
> from gawk's system() function?  One of these might
> be informative:
>
>   gawk 'BEGIN{system("ps -l")}'
>
>   gawk 'BEGIN{system("pstree $$")}'
>
> On most Debian-derived systems, the system default
> shell is dash--i.e., /bin/sh is a symlink to dash.
> I believe bash recognizes the redirection
>
>     &> /dev/null
>
> as a short form of
>
>     > /dev/null 2>&1
>
> but dash does not.  So you might be able to fix
> the problem by using the latter form, which should
> work in both bash and dash.
>
> Good luck.
>
> --Neil Ormos



reply via email to

[Prev in Thread] Current Thread [Next in Thread]