aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Hiar <codyfh@gmail.com>2017-11-23 09:32:15 -0700
committerCody Hiar <codyfh@gmail.com>2017-11-23 09:32:15 -0700
commit7539bd01e67edc28cfb66a2c93bce8317f35ef4e (patch)
tree54a441327d2a8b61baf07dcb410b8b9a4c493f27
parentc14a14e9b8843cb844363a6718057bb7499fd42a (diff)
Get last jrnl entry if it exists
-rwxr-xr-xscripts/powerline.sh8
1 files changed, 7 insertions, 1 deletions
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