如何将多行 bash 代码粘贴到终端并一次运行? [英] How do I paste multi-line bash codes into terminal and run it all at once?

查看:18
本文介绍了如何将多行 bash 代码粘贴到终端并一次运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将多行 bash 代码粘贴到终端中,但是每当我这样做时,每一行都会在粘贴后立即作为单独的命令运行.

I need to paste a multi-line bash code into terminal, but whenever I do, each line gets run as a separate command as soon as it gets pasted.

推荐答案

在复制之前尝试将 放在每行的末尾.

Try putting at the end of each line before copying it.

示例:

echo "Hello world" && 
script_b.sh

echo $?

退出代码 ($?) 现在是完整的命令序列,而不仅仅是最后一个命令.

The exit code ($?) is now the full sequence of commands, and not just the last command.

这篇关于如何将多行 bash 代码粘贴到终端并一次运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆