Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Surely this can be done easier...
- X-seq: zsh-users 6961
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Re: Surely this can be done easier...
- Date: Wed, 24 Dec 2003 21:43:06 +0000
- In-reply-to: <20031224211027.GA30731@DervishD>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20031224211027.GA30731@DervishD>
On Dec 24, 10:10pm, DervishD wrote:
}
} I have a file containing a list of files, and I want those files
} in a command line. The problem is that the filenames contain weird
} characters, spaces and so on.
This is pretty close to a FAQ.
First you read the entire file like this:
$(<listing)
Next you need to quote that to protect the lines from being joined:
"$(<listing)"
Next you split on line breaks:
${(f)"$(<listing)"}
And that's the argument of the command:
command ${(f)"$(<listing)"}
In some older versions of zsh you need to move the quotes outside the
whole expression:
command "${(f)$(<listing)}"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author