Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong
GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/packages/bsp/common/etc/update-motd.d/35-orangepi-tips
13915 views
#!/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/orangepi-motd
# any changes will be lost on board support package update

THIS_SCRIPT="tips"
MOTD_DISABLE=""

[[ -f /etc/default/orangepi-motd ]] && . /etc/default/orangepi-motd

for f in $MOTD_DISABLE; do
	[[ $f == $THIS_SCRIPT ]] && exit 0
done

quotes="/etc/update-motd.d/quotes.txt"
if [[ -f $quotes ]]; then
        random_line=$(shuf -i 1-$(wc -l < $quotes) -n 1)
        quote=$(sed -n -e "$random_line"p $quotes)
        [[ -n $quote ]] && echo -e "\e[93mTip of the day:\e[39m $quote\n"
fi