开发者

bashdb: Can I examine the data flowing through a pipe?

开发者 https://www.devze.com 2023-01-01 14:17 出处:网络
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:

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)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号