bash脚本可以在退出时用命令预填充提示吗? [英] Can a bash script prepopulate the prompt with a command to run when it exits?

查看:72
本文介绍了bash脚本可以在退出时用命令预填充提示吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为FFmpeg运行多个bash脚本.但是,由于打开了多个窗口,因此我无法跟踪运行的文件,因为我直接从脚本执行文件,因此没有运行历史的记录.唯一的历史记录是我调用的第一个文件

I run multiple bash script for FFmpeg. However, since I have several windows open, I lose track of what file I ran since I execute the file directly from the script there is no history of what I ran. The only history there is the first file I called

例如:

enter tv number i.e 19: 19
 stream key: key
 Press [enter] to execute tv19

我按Enter键,它运行tv19,但是在该窗口中没有运行tv19的记录,因此如何将命令回显到$

I press enter, and it runs tv19 but there is no record I ran tv19 in that window, so how can I echo the command to the $

像这样

[ibrod ~]$ ./tv19

然后我可以按Enter键并使用向上箭头,直到我知道我在那个腻子窗口中运行了什么文件.

than I can press enter and use the up arrow than I know what file I ran in that putty window.

推荐答案

感谢您的帮助,我想出了另一种方法.我将提示更改为[tv10〜] $

Thanks for the help, I figured another way. I change the prompt like [tv10 ~]$

只是更改了文件,放入了我的

just made a file changetv i put inside

PS1="[$1 \W]\$ "

所以我运行文件并将其命名为

so I run the file and call it as

. ./changetv tv10

所以现在我知道什么窗口是什么. :)

so now I know what window is what. :)

这篇关于bash脚本可以在退出时用命令预填充提示吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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