views:

34

answers:

1

I'm trying to debug a bash script that involves a command of the form:

VAR=$(cmd1|cmd2|cmd3)

I can debug it in bashdb, using the s command, which does something like this:

bashdb(2): s
2:      VAR=$(cmd1|cmd2|cmd3)
cmd1
bashdb(3): s
2:      VAR=$(cmd1|cmd2|cmd3)
cmd2

i.e. it allows me to run the commands in the pipe one by one. Logic indicates that it must therefore store the contents of the pipe somewhere, so that it can feed it into the next command when I type s again. How do I get bashdb to show this data?

+1  A: 

Try tee.

VAR=$(cmd1|tee cmd1.out|cmd2|tee cmd2.out|cmd3|tee cmd3.out)
scompt.com