Setting a terminal header is easy with echo -e "\e]0;some title\007". It works with almost all terminal programs.
echo -e "\e]0;some title\007"
I want to set the title of the terminal when some program starts, and restore the old one when it ends. Is it possible?
There are some terminal programs that support it (xterm has compile-time options, as indicated by RWS), but most terminal programs simply lack such a function, including, in particular, Terminal.app.
xterm 22 23 ,
#!/bin/sh /bin/echo -ne '\033[22;0t' # Save title on stack /bin/echo -ne "\033]0;$(date)\007" sleep 1 /bin/echo -ne '\033[23;0t' # Restore title from stack
, Mac OS X Terminal.App.
Yes it is possible. See the Reference Guide xterm(for example, this ) and go through it. xtermhas a built-in stack for this, so you do not need to save the header manually.
xterm
My solution was to set the window title during my script and then disable the window title when I was done. Cancellation of the header returned to its original value. In particular, I did the following:
# Set the terminal title printf "\e]2;%s\a" "running my script" # Do whatever processing is required. ... # Restore terminal title printf "\e]2;\a"
Source: https://habr.com/ru/post/1754317/More articles:Filtering derived classes in Entity set to Ofty and exception - c #100% horizontal cross browser HTML / CSS menu? - htmlmake zero last in the list of ascending numbers - sqlHow can I get an instance of BackgroundWorker from the current method? - multithreadingNHibernate: why mutable properties should be marked as virtual for lazy loading - virtualShould I comment correctly on this fragment of my request? - sql-serverhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1754319/is-there-a-way-to-force-pdfs-to-open-in-adobe-reader-rather-than-in-plugins&usg=ALkJrhg2jBugWeETO91Pbra74OpMM0rQhgXerces C ++: no error for a nonexistent file - c ++Google Maps API for Android in WallpaperService (live wallpaper) - androidHow To Fix Perl Rounding Errors - perlAll Articles