help-bash
[Top][All Lists]
Advanced

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

Re: Can't find file


From: Eduardo Bustamante
Subject: Re: Can't find file
Date: Sat, 9 Nov 2019 16:57:20 -0800

On Sat, Nov 9, 2019 at 4:45 PM David Niklas <address@hidden> wrote:
>
> Hello,
>
> ls -- $( awk -v z="../EXAMPLE FILE NAME" 'BEGIN{ print z }' )
>
> I've tried single and double quotes in the print part of the awk 1 liner
> without success.
> I've also tried double quoting the whole thing without any change.
>
> I've no idea what's going on. The file does exist. You can ls it without
> the awk 1 liner.

The unquoted command substitution (i.e. the `$(...)' bit) is what's
causing the problem. Since it's not quoted, bash will perform word
splitting on AWK's output. See: http://mywiki.wooledge.org/Quotes

Use this instead:

ls -- "$( awk -v z="../EXAMPLE FILE NAME" 'BEGIN{ print z }' )"



reply via email to

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