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

Re: Bash question: get output as a variable?

On Fri, Feb 5, 2010 at 10:10 AM, Chris Jackson
<c.jackson@shadowcat.co.uk> wrote:
> Use $() like you do with the date command. You have to redirect stderr back
> to stdout, which means running it in a subshell:
> FILES=$( ( tar -zcvf - *  --exclude-from $EXCLUDES  | openssl des3 -salt -k
> $1 | dd of=$(hostname)-$(date +%Y%m%d).tbz ) 2>&1 )
> It may cause unexpected results if there're spaces in the filenames though.

I think this is the best method I've seen thus far.  Putting the data
into an array should avoid problems with file names containing spaces.
 I don't understand why he would stderr in it, though.  I'd like to
know what the OP plans to do with the list of processed files.

Reply to: