È ansible get GNU Screen per visualizzare l'output di un command arbitrario, ad esempio who | wc -l
who | wc -l
, nella barra di stato, rinfrescando, ad esempio, each minuto?
Sì, puoi utilizzare la function backtick. backtick
Hai inserito una row nel tuo file screenrc:
backtick 1 0 5 /bin/date
Se capisco correttamente, significa backtick id 1, che esegue command /bin/date
, produce output valido per 0 secondi e la didascalia / firmware dovrebbe essere aggiornata each 5 secondi.
Ora, puoi usare la string %1`
all'interno del tuo hardstatus per la sostituzione, ad esempio
hardstatus alwayslastline "date output: %1`"
Nel tuo caso, penso che dovrai scrivere uno script. Ad esempio, $HOME/my_script.sh
:
#!/bin/bash who | wc -l
Nel tuo ~/.screenrc
:
backtick 1 0 60 $HOME/my_script.sh hardstatus alwayslastline "who|wc -l output: %1`"
Ovviamente non si desidera esattamente questo, ma basta aggiungere %1`
a qualsiasi altra cosa. Si noti che l'output del tuo script non può includere fughe di stringhe per lo schermo da espandere, ad esempio se il tuo script è echo "%{bg}blue on green%{dd}"
non verrà colorato, vedrai solo ${bg}
e ${dd}
nella tua row di stato.