Can a bash script prepopulate the prompt with a command to run when it exits?

匿名 (未验证) 提交于 2019-12-03 01:58:03

问题:

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

for example:

enter tv number i.e 19: 19  stream key: key  Press [enter] to execute 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 $

like this

[ibrod ~]$ ./tv19 

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

回答1:

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. :)



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!