rendick
Posted on May 23, 2022
Hey! Today I will tell you how to create greetings after the launch Linux Terminal.
First, create folder
mkdir welcome-script
cd welcome-script/
After this, you need to create .sh file
touch welcome.sh
You need to open welcome.sh file via Vim
sudo vim ./welcome.sh
Basic commands
echo - command that output text, etc.
Variable (programming) - named
Commands in a variable - output anything, function
sleep - time to finish something after the time
u - variable for Linux function(like Username, OS version, etc)
$ - for output Linux command. Example: os=$(whoami) (variable=function for command(command)
Code
#!/bin/bash
name="Name"
u="$USER"
echo " "
echo " "
echo "░█░█░█░█▀▀▀░█░░░░█▀▀▀░█▀▀█░█▀█▀█░█▀▀▀░"
echo "░█░█░█░█▀▀▀░█░░░░█░░░░█░░█░█░█░█░█▀▀▀░"
echo "░▀▀▀▀▀░▀▀▀▀░▀▀▀▀░▀▀▀▀░▀▀▀▀░▀░▀░▀░▀▀▀▀░"
sleep 1
echo " "
now=$(date)
echo "Current time: $now"
echo " "
echo "Hello $USER!"
sleep 1
echo " "
os=$(uname -r)
echo "Your OS is $os"
echo " "
sleep 1
setup=$(neofetch)
echo "Your PC stats: $setup"
echo " "
sleep 1
Edit .bashrc
Open your file manager and paste this command
/home/YOURUSER/.bashrc/
And now you need to paste command to .bashrc
source /home/YOURUSER/welcome-script/welcome.sh
Source code
You can easily download this script from my GitHub repository.
Posted on May 23, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.