sách gpt4 ai đã đi

Làm thế nào để tạm dừng một shell nền bằng cách sử dụng một tập lệnh?

In lại 作者:行者123 更新时间:2023-12-04 23:36:15 26 4
mua khóa gpt4 Nike

不幸的是,我没有suspend 命令(busybox/ash)。但是我可以使用 kill -STOP $$ 从后台 shell (sh &) 返回到父 shell(以及 fg 之后)。
但是我不想输入这个长的 kill-command 我想写一个脚本(命名为 suspend)应该这样做:

#!/busybox sh
kill --STOP $$

但这没有用。看来我又开了一个shell,同时挂了。

那么什么是正确的挂起脚本,我该如何调用它(thực hiện?)?

1 Câu trả lời

总结一下我在上面的评论中写的内容:

theothis website,为您尝试执行的操作获取简单命令的最简单方法是在您的~/.profile 中创建别名。 .

echo 'alias suspend=kill --STOP $$' >> ./~profile # Add alias to .profile
source ./~profile # Let ash update its list of aliases

现在您可以使用一个简短的suspendĐặt hàng.

使用脚本可能很难做到这一点,因为子进程不能轻易(或根本)修改父进程的环境。

关于shell - 如何使用脚本暂停后台 shell?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35845423/

26 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com