From 7539bd01e67edc28cfb66a2c93bce8317f35ef4e Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Thu, 23 Nov 2017 09:32:15 -0700 Subject: Get last jrnl entry if it exists --- scripts/powerline.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/powerline.sh b/scripts/powerline.sh index 8baf3f2..5dd6cb5 100755 --- a/scripts/powerline.sh +++ b/scripts/powerline.sh @@ -4,7 +4,13 @@ LS="" if [[ "$1" == "left" ]]; then echo -n "#[fg=colour235, bg=colour142] $(tmux display-message -p '#S') #[fg=colour142, bg=colour241]$LS#[default]" - echo -n "#[fg=colour223, bg=colour241] $(hostname) #[fg=colour241, bg=colour235]$LS#[default]" + if [[ -f "$HOME/journal.txt" ]]; then + LAST_ENTRY=$(tail -n 1 ~/journal.txt | awk '{ $1=""; print }' | cut -c2-40) + LAST_ENTRY+="..." + else + LAST_ENTRY=$(hostname) + fi + echo -n "#[fg=colour223, bg=colour241] $LAST_ENTRY #[fg=colour241, bg=colour235]$LS#[default]" fi if [[ "$1" == "right" ]]; then -- cgit v1.2.3