help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Pathname expansion without word splitting


From: Geir Hauge
Subject: Re: [Help-bash] Pathname expansion without word splitting
Date: Thu, 17 Sep 2015 09:58:02 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Thu, Sep 17, 2015 at 12:41:45PM +1200, Sebastian Unger wrote:
> Hi There,
> 
> I have tried to work this out by myself, but despite many years experience
> writing bash scripts I was stumped a bit by this one:
> 
> Given an array of pathname patterns, create a new array with all matching
> file names (and only those) without running an external command. Be aware
> that the pathname patterns may contain blanks (otherwise it would be too
> simple ;-).

You disable word splitting by assigning the empty string to IFS

    shopt -s nullglob
    IFS=
    array=( address@hidden )

-- 
Geir Hauge



reply via email to

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