[Top][All Lists]

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

Re: expansion and redirections

From: Greg Wooledge
Subject: Re: expansion and redirections
Date: Thu, 3 Oct 2013 17:28:38 -0400
User-agent: Mutt/

On Wed, Oct 02, 2013 at 05:25:47PM +0300, Telychko wrote:
> $exec 3</dev/zero    # open /dev/zero on 3
> $VAR=3               # have some variable with file descriptor
> $exec $VAR<&-        # trying to close previously opened file descriptor
> bash: exec: 3: not found

What you want is:

eval "exec $VAR<&-"

reply via email to

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