You are not logged in.
I have a screen session im configuring which opens a screen, then vertically splits, then opens 4 more on the right. some of these screens are running commands right off the bat, for example mysql -p.
Im trying to figure out how to echo out a title before this command is run, so that instead of in the mysql screen saying
Enter password:I want it to say
Logging into Mysql:
Enter password:i tried various version of echo, but cant get a line to print on the top of each screen which i need a line of text.
heres my .screenrc
$ cat .screenrc
startup_message off
activity "%c activity -> %n%f %t"
caption always "%{= Wk}%-w%{= Bw}%n %t%{-}%+w %-="
vbell off
#term screen-256color
escape ``
#hardstatus alwayslastline
#hardstatus string "%-w%{= BW}%50>%n %t%{-}%+w%<"
#archlinux
hardstatus off
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W} %c %{g}]'
backtick 1 5 5 true
termcapinfo rxvt* 'hs:ts=\E]2;:fs=\007:ds=\E]2;\007'
#hardstatus string "screen (%n: %t)"
caption string "%{= kw}%Y-%m-%d;%c %{= kw}%-Lw%{= kG}%{+b}[%n %t]%{-b}%{= kw}%+Lw%1`"
caption always
# Enable 256-color mode when screen is started with TERM=xterm-256color
# Taken from: [url]http://frexx.de/xterm-256-notes/[/url]
#
# Note that TERM != "xterm-256color" within a screen window. Rather it is
# "screen" or "screen-bce"
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
#termcapinfo xterm-256color 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
terminfo xterm-color hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
term xterm-color
# Don't block command output if the terminal stops responding
# (like if the ssh connection times out for example).
nonblock on
bind 'K' kill
bind 'W' windowlist
bind 'V' split -v
#shelltitle custom screen
# F8 to turn the status bar off
#bindkey -k k8 hardstatus alwayslastline
# F9 to turn the status bar on
#bindkey -k k9 hardstatus alwaysignore
# F5 and F6 to move one screen forward or backward
#bind F7 to change focus
bindkey -k k7 focus up
bindkey -k k5 prev
bindkey -k k6 next
#use x scrolling method of scrollbar
#termcapinfo xterm* ti@:te@
#screens
screen -t Main 1 bash
echo -n Main vertical screen
#echo -ne '\ekcommand-line\e\\'
#echo -e "\033[s\033[2;0HHello World! \n \033[u"
vert_split
focus down
screen -t top 2 top
select top
split
focus down
screen -t php.ini 3 vim /etc/php/php.ini
select php.ini
opening php.ini
#chdir /etc/php
#exec vim php.ini
split
focus down
screen -t httpd 4 bash
select httpd
echo -n restarting htttpd
exec sudo systemctl restart httpd
split
focus down
#screen -t Bash5 5 bash
#select Bash5
#split
#focus down
screen -t mysq1 5 mysql -p
echo -n Logging you into mysql:
#go to default screen now
#go back to first window
focus top
# Allow editors etc. to restore display on exit
# rather than leaving existing text in place
altscreen onLast edited by wolfdogg (2013-12-11 20:41:21)
Offline
Please learn how to paste code to the boards: https://wiki.archlinux.org/index.php/Fo … s_and_Code
Offline
geese, give a man a chance....
i.e. more than 86 seconds :-)
That was a quick response though, too bad it didnt contain a quick answer too, lol.
Last edited by wolfdogg (2013-12-11 20:44:12)
Offline
From your .screenrc, rather than calling mysql, call a wrapper that echoes your desired text and then launches mysql.
Offline
Offline
I don't know how screen works, but I imagine it is similar to tmux, in which case I'd just:
screen -t mysq1 5 /path/to/launchmysqlscriptAnd in the launchmysqlscript
printf "%s\n" "Logging into MySQL" && mysql -pOffline
ok i see what your saying. thanks. yes its basically the same. are you thinking then that there isnt a command that already allows a simple line to be output before a command is run, i.e.
screen -t mysq1 5 bash
echo -n Logging you into mysql:
exec mysql -pbut it appears echo isnt the right command for this. heres the link for the commands list http://aperiodic.net/screen/commands:start but i cant seem to find one appropriate for the job to replace the 'echo' portion with. Or maybe the echo is the correct one, and the line just isnt displaying because of the fact that the screen is being split, which is kind of what i was expecting to be the problem.
Offline