A Basic Shell Program #Linux/Unix: Shell Programming – 001

#!/bin/sh

#if enabled – will spit out the script to the screen
#set -v

#clear the screen
clear

echo “SCRIPT BEGINS”

#shows current login name
echo “Hello $LOGNAME”

#shows current date in the same line
echo “Todays date is: c”
date +%m/%d/%y

#shows current time in the same line
echo “and the current time is: c”
date +%H:%M:%S%n

#shows a list of the processes
echo “Now a list of the processes in the current shell”
ps

echo “SCRIPT FINISHED!!”

#example of how to use a variable
NAME=”Justetc”
echo $NAME
——————————————–
Output – ????????? ?? ?????

SCRIPT BEGINS
Hello shell
Todays date is: 04/15/18
and the current time is: 14:46:43

Now a list of the processes in the current shell
PID TTY TIME CMD
14522 pts/2 0:00 bash
14590 pts/2 0:00 a_basic_
14595 pts/2 0:00 ps
14508 pts/2 0:00 sh
SCRIPT FINISHED!!
Justetc From: http://sitestree.com/?p=12175
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-04-16 18:09:14

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada