On 05.02.2010 09:07, Ken Teague wrote: > On Thu, Feb 4, 2010 at 2:09 PM, Dotan Cohen <dotanco...@gmail.com> wrote: >> I'm scripting a backup solution, the line that does the business looks >> like this: >> >> tar -zcvf - * --exclude-from $EXCLUDES | openssl des3 -salt -k $1 | >> dd of=$(hostname)-$(date +%Y%m%d).tbz >> >> Because of the "v" flag tar writes to stdout the name of each file >> copied. How can I get that output redirected to a variable, to use >> later in the script? > > You probably want to put the data into an array rather than a > variable. An explanation of how to do so can be found here: > http://tldp.org/LDP/abs/html/arrays.html > > #!/bin/bash
tar ... 2> "$filename" mapfile array1 < "$filename" (don't know actually why '-u 2' option for mapfile does not complete for me? would make it a 'one-liner'.) on bash4.0+ regards Mart -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org