Re: Bash question: get output as a variable?

2010-02-06 Thread Mart Frauenlob
On 04.02.2010 23:09, Dotan Cohen 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

Re: Bash question: get output as a variable?

2010-02-06 Thread Javier Barroso
On Fri, Feb 5, 2010 at 7:10 PM, Chris Jackson c.jack...@shadowcat.co.uk wrote: Dotan Cohen 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

Re: Bash question: get output as a variable?

2010-02-06 Thread Mart Frauenlob
On 06.02.2010 14:17, Javier Barroso wrote: On Fri, Feb 5, 2010 at 7:10 PM, Chris Jackson c.jack...@shadowcat.co.uk wrote: Dotan Cohen 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

Re: Bash question: get output as a variable?

2010-02-06 Thread Mart Frauenlob
On 06.02.2010 13:39, Mart Frauenlob wrote: On 04.02.2010 23:09, Dotan Cohen 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

Re: Bash question: get output as a variable?

2010-02-06 Thread Mart Frauenlob
On 06.02.2010 15:43, Mart Frauenlob wrote: On 06.02.2010 14:17, Javier Barroso wrote: On Fri, Feb 5, 2010 at 7:10 PM, Chris Jackson c.jack...@shadowcat.co.uk wrote: Dotan Cohen wrote: I'm scripting a backup solution, the line that does the business looks like this: tar -zcvf - *

Re: Bash question: get output as a variable?

2010-02-05 Thread Alexey Salmin
On Fri, Feb 5, 2010 at 1:20 PM, Javier Barroso javibarr...@gmail.com wrote: On Fri, Feb 5, 2010 at 1:06 AM, Stephen Powell zlinux...@wowway.com wrote: On Thu, 4 Feb 2010 17:42:45 -0500 (EST), Javier Barroso wrote: In this case output goes to stderr, so: tar -zcvf - * --exclude-from $EXCLUDES

Re: Bash question: get output as a variable?

2010-02-05 Thread Ken Teague
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

Re: Bash question: get output as a variable?

2010-02-05 Thread bruno
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

Re: Bash question: get output as a variable?

2010-02-05 Thread Mart Frauenlob
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

Re: Bash question: get output as a variable?

2010-02-05 Thread Stephen Powell
On Fri, 5 Feb 2010 02:20:48 -0500 (EST), Javier Barroso wrote: If you are using stdout as tar output, including filenames there will corrupt that output, so it is logical that in this case filenames goes to stderr. That does make sense, now that I think about it. I didn't look closely enough.

Re: Bash question: get output as a variable?

2010-02-05 Thread Ken Teague
On Fri, Feb 5, 2010 at 12:39 AM, bruno bruno.deb...@cyberoso.com wrote: Why not simply use the  t option for content listing : tar tvf  * --exclude-from $EXCLUDES He's already creating the archive with -v. Why process the archive a 2nd time just to get a listing when it comes from stdout the

Re: Bash question: get output as a variable?

2010-02-05 Thread bruno
Ken Teague wrote: On Fri, Feb 5, 2010 at 12:39 AM, bruno bruno.deb...@cyberoso.com wrote: Why not simply use the t option for content listing : tar tvf * --exclude-from $EXCLUDES He's already creating the archive with -v. Why process the archive a 2nd time just to get a listing

Re: Bash question: get output as a variable?

2010-02-05 Thread Paul E Condon
On 20100205_135919, Alexey Salmin wrote: On Fri, Feb 5, 2010 at 1:20 PM, Javier Barroso javibarr...@gmail.com wrote: On Fri, Feb 5, 2010 at 1:06 AM, Stephen Powell zlinux...@wowway.com wrote: On Thu, 4 Feb 2010 17:42:45 -0500 (EST), Javier Barroso wrote: In this case output goes to stderr,

[OT] - Bash question: get output as a variable?

2010-02-05 Thread Stephen Powell
On Fri, 5 Feb 2010 10:44:28 -0500 (EST), bruno wrote: Ken Teague wrote: On Fri, Feb 5, 2010 at 12:39 AM, bruno bruno.deb...@cyberoso.com wrote: Why not simply use the t option for content listing : tar tvf * --exclude-from $EXCLUDES He's already creating the archive with -v.

Re: [OT] - Bash question: get output as a variable?

2010-02-05 Thread John Hasler
Stephen Powell writes: I wish the shell supported multi-stream pipelines. I think you could fake it with tee and a fifo. -- John Hasler -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Re: [OT] - Bash question: get output as a variable?

2010-02-05 Thread Bob McGowan
Stephen Powell wrote: On Fri, 5 Feb 2010 10:44:28 -0500 (EST), bruno wrote: Ken Teague wrote: On Fri, Feb 5, 2010 at 12:39 AM, bruno bruno.deb...@cyberoso.com wrote: Why not simply use the t option for content listing : tar tvf * --exclude-from $EXCLUDES He's already creating

Re: Bash question: get output as a variable?

2010-02-05 Thread Bob McGowan
Dotan Cohen 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

Re: Bash question: get output as a variable?

2010-02-05 Thread Bob McGowan
Dotan Cohen 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

Re: [OT] - Bash question: get output as a variable?

2010-02-05 Thread Stephen Powell
On Fri, 5 Feb 2010 11:39:26 -0500 (EST), John Hasler wrote: Stephen Powell writes: I wish the shell supported multi-stream pipelines. I think you could fake it with tee and a fifo. Well, I know about tee; but, although I've heard the term fifo, I know nothing about it in a Linux/Unix/shell

Re: Bash question: get output as a variable?

2010-02-05 Thread Chris Jackson
Dotan Cohen 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

Re: Bash question: get output as a variable?

2010-02-05 Thread Boyd Stephen Smith Jr.
On Friday 05 February 2010 10:01:45 Paul E Condon wrote: Traditional Unix and traditional C both made provision for stdin, stdout, and stderr. When Stroustrup, et al., started working on C++ and its earlier predicessors, someone recognized the need for a fourth stdXXX, namely stdlog. If you

Re: Bash question: get output as a variable?

2010-02-05 Thread Brian Ryans
Quoting Stephen Powell on 2010-02-04 18:06:58: but in the general case, it's hard to tell. Since stdout and stderr both default to the terminal, and since the doc doesn't say, how else would you know other than by trial and error? Trial and error is an effective way to figure it out. [1]

Re: [OT] - Bash question: get output as a variable?

2010-02-05 Thread Stephen Powell
On Fri, 5 Feb 2010 12:42:47 -0500 (EST), Bob McGowan wrote: Stephen Powell wrote: This is off topic from the OP's question, but one of the things that I miss in the Linux environment that I used to use a lot in the CMS environment is CMS Pipelines. The shell supports pipelines, but they are

Re: [OT] - Bash question: get output as a variable?

2010-02-05 Thread Boyd Stephen Smith Jr.
On Friday 05 February 2010 14:47:21 Stephen Powell wrote: On Fri, 5 Feb 2010 12:42:47 -0500 (EST), Bob McGowan wrote: Let me give you a simple example of a CMS pipeline for illustrative purposes, so that you will get some idea of what I'm talking about. [snip: Long, but very useful

Re: [OT] - Bash question: get output as a variable?

2010-02-05 Thread Bob McGowan
Boyd Stephen Smith Jr. wrote: On Friday 05 February 2010 14:47:21 Stephen Powell wrote: On Fri, 5 Feb 2010 12:42:47 -0500 (EST), Bob McGowan wrote: Let me give you a simple example of a CMS pipeline for illustrative purposes, so that you will get some idea of what I'm talking about.

Re: [OT] - Bash question: get output as a variable?

2010-02-05 Thread Boyd Stephen Smith Jr.
On Friday 05 February 2010 16:33:12 Bob McGowan wrote: Boyd Stephen Smith Jr. wrote: mkfifo LOCM mkfifo FIN ( | NFIND | LOCATE 2 LOCM | FANINANY 2 FIN| LOCATE LOCM FIN wait ) which would disallow having the parallel processing implied by the above diagram.

Re: [OT] - Bash question: get output as a variable?

2010-02-05 Thread Bob McGowan
Boyd Stephen Smith Jr. wrote: On Friday 05 February 2010 16:33:12 Bob McGowan wrote: Boyd Stephen Smith Jr. wrote: mkfifo LOCM mkfifo FIN ( | NFIND | LOCATE 2 LOCM | FANINANY 2 FIN| LOCATE LOCM FIN wait ) which would disallow having the parallel processing implied by

Re: Bash question: get output as a variable?

2010-02-05 Thread Ken Teague
On Fri, Feb 5, 2010 at 7:44 AM, bruno bruno.deb...@cyberoso.com wrote: because it's a simplier way to get the list into a variable Can you please explain how it's simpler. The method I suggested certainly isn't as easy, but the method I suggested merely showed a detailed example. Others here

Re: Bash question: get output as a variable?

2010-02-05 Thread Ken Teague
On Fri, Feb 5, 2010 at 10:10 AM, Chris Jackson c.jack...@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

Re: Bash question: get output as a variable?

2010-02-05 Thread Tony Nelson
On 10-02-04 19:06:58, Stephen Powell wrote: On Thu, 4 Feb 2010 17:42:45 -0500 (EST), Javier Barroso wrote: In this case output goes to stderr, so: tar -zcvf - * --exclude-from $EXCLUDES 2 /tmp/data$$ | openssl ... Is that something you just have to find out by trial and error? I

Re: Bash question: get output as a variable?

2010-02-05 Thread Ken Teague
On Fri, Feb 5, 2010 at 12:42 AM, Mart Frauenlob mart.frauen...@chello.at wrote: 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+ This is a great example as well. The only

Re: Bash question: get output as a variable?

2010-02-05 Thread Bob McGowan
Ken Teague wrote: On Fri, Feb 5, 2010 at 10:10 AM, Chris Jackson c.jack...@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

Re: [OT] - Bash question: get output as a variable?

2010-02-05 Thread Stephen Powell
On Fri, 5 Feb 2010 18:27:49 -0500 (EST), Bob McGowan wrote: If someone wanted to, they could write a single program that would read input/write output from/to two or more descriptors, and use it to create a multi-path'ed I/O processing sequence, but writing it to prevent blocking on one

Bash question: get output as a variable?

2010-02-04 Thread Dotan Cohen
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

Re: Bash question: get output as a variable?

2010-02-04 Thread Alex Samad
On Fri, Feb 05, 2010 at 12:09:28AM +0200, Dotan Cohen 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

Re: Bash question: get output as a variable?

2010-02-04 Thread Stephen Powell
On Thu, 4 Feb 2010 17:09:28 -0500 (EST), Dotan Cohen 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

Re: Bash question: get output as a variable?

2010-02-04 Thread Javier Barroso
On Thu, Feb 4, 2010 at 11:32 PM, Stephen Powell zlinux...@wowway.com wrote: On Thu, 4 Feb 2010 17:09:28 -0500 (EST), Dotan Cohen 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

Re: Bash question: get output as a variable?

2010-02-04 Thread Stephen Powell
On Thu, 4 Feb 2010 17:42:45 -0500 (EST), Javier Barroso wrote: In this case output goes to stderr, so: tar -zcvf - * --exclude-from $EXCLUDES 2 /tmp/data$$ | openssl ... Is that something you just have to find out by trial and error? I checked the man page for tar, and there's nothing in

Re: Bash question: get output as a variable?

2010-02-04 Thread Javier Barroso
On Fri, Feb 5, 2010 at 1:06 AM, Stephen Powell zlinux...@wowway.com wrote: On Thu, 4 Feb 2010 17:42:45 -0500 (EST), Javier Barroso wrote: In this case output goes to stderr, so: tar -zcvf - * --exclude-from $EXCLUDES 2 /tmp/data$$ | openssl ... Is that something you just have to find out by