DEV Community

Cover image for chinese new year in zsh
karleeov
karleeov

Posted on

chinese new year in zsh

Adding to your zsh with chinese new year greeting

# Chinese New Year CLI
# This function prints a random Chinese New Year greeting when a new terminal session is started
function cny_greeting() {
  # Define an array of greetings
  local greetings=("新年快乐 (Xīnnián Kuàilè) - Happy New Year!" "恭喜发财 (gōngxǐfācái) - May you have a prosperous year!" "兔年大吉 (tùnián dàjí) - Happy Year of the Rabbit (2023)" "岁岁平安 (suìsuì píng'ān) - May you have peace year after year" "万事如意 (wànshìrúyì) - May all your hopes be fulfilled")
  # Get a random index from 0 to 4
  local index=$((RANDOM % 5))
  # Print the greeting in red color
  echo -e "\033[0;31m${greetings[$index]}\033[0m"
}

# Call the function at the end of the file
cny_greeting
Enter fullscreen mode Exit fullscreen mode

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay