bashdb: Can I examine the data flowing through a pipe?
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 th开发者_开发知识库e next command when I type s
again. How do I get bashdb to show this data?
Try tee.
VAR=$(cmd1|tee cmd1.out|cmd2|tee cmd2.out|cmd3|tee cmd3.out)
精彩评论