[Top][All Lists]

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

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

From: Neil R. Ormos
Subject: Re: [bug-gawk] Strange no-print error (user script regression)
Date: Tue, 17 Apr 2018 03:26:45 -0500 (CDT)

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]