(ConEmu + Cygwin) How to change ConEmu tab name from cygwin bash script

I am setting up a ConEmu + Cygwin environment. I created a task, when I launched it on a tab, the task will launch a batch file, which, in turn, will change the directory in cygwin and run

bash --login -i my_ssh_entry_script.sh 

Inside my_ssh_entry_script.sh it will read the configuration file in my home directory and then print a menu so that I can choose which host should connect. And finally

 ... exec ssh -p$port $userhost 

Now I can work on the selected machine in the same conemu tab. It works great. And the script also works on a Linux machine.

But there is a slight flaw. I can not change the title of the tab. I tried changing it to:

 .... exec $(cygpath ${ConEmuDir})/ConEmu.exe /cmd ssh -p$port $userhost -cur_console:t:$title 

But this will always create a new tab. Any suggestion to use it? Thanks ~

+7
bash cygwin conemu
source share
2 answers

1) You need GuiMacro, described in detail in the project wiki: http://conemu.imtqy.com/en/GuiMacro.html

 ConEmuC -GuiMacro Rename 0 "Title" 

2) You do not need to start a batch. This causes the extra and useless cmd.exe in your process tree. You can do all the necessary “CD” and “SET” directly from the contents of the task.

+9
source share

At least for the cmd shell: "- new_console: d: C: \ Users \ dir_name" cmd / V / K -new_console: t: Tab_renamed

+3
source share

All Articles