#!/bin/bash # # Copyright (c) Authors: https://www.armbian.com/authors # # This file is licensed under the terms of the GNU General Public # License version 2. This program is licensed "as is" without any # warranty of any kind, whether express or implied. # DO NOT EDIT THIS FILE but add config options to /etc/default/armbian-motd # any changes will be lost on board support package update THIS_SCRIPT="tips" MOTD_DISABLE="" [[ -f /etc/default/armbian-motd ]] && . /etc/default/armbian-motd for f in $MOTD_DISABLE; do [[ $f == $THIS_SCRIPT ]] && exit 0 done quotes="/etc/update-motd.d/quotes.txt" if [[ -f $quotes && $(( $RANDOM % 1 )) == 0 ]]; then random_line=$(shuf -i 1-$(wc -l < $quotes) -n 1) quote=$(sed -n -e "$random_line"p $quotes) DUE_DATE=$(echo $quote | cut -d"|" -f1) SELECTED_QUOTE=$(echo $quote | cut -d"|" -f2) if [[ -n $SELECTED_QUOTE && $(date +'%Y-%m-%d') < $(date -d $DUE_DATE +"%Y-%m-%d") ]]; then echo -e "\e[93mTip of the day:\e[39m $SELECTED_QUOTE\n" fi fi