In: Computer Science
Please find below the solution to your question, also find the
screenshot of the output which I got after running this code.
1. subroutine1 covers the all 5 points mentioned in the
question
2. subroutine2 calling to other scripts(correct the file path as
per your file location)
#!/bin/sh
subroutine1()
{
#echo "Arg 1: $1"
echo "user Login Name : $(echo $USER)"
echo "Current date and time : $(date)"
echo "System Boot Time:"
who -b
echo "Current Working Path:"; pwd
echo "Shell Type:" $SHELL
echo "*******************************************"
echo "Home Directroy:" $HOME
echo "Number of files and directories in home:"
#sudo apt install tree ( if you haven't already installed in your system)
tree $HOME | tail -1
echo "*******************************************"
}
subroutine2()
{
echo "inside subroutine2"
#correct the file path as per your file location.
/home/abhishek/Downloads/FileS.sh
/path/to/files/Work.sh
/path/to/files/Ether.sh
/path/to/files/Arch.sh
/path/to/files/Buzz.sh
}
subroutine1
subroutine2
output:
(I havent specify the file path therfore in screenshot you are
seeing error file not found) but It is worked fine for FileS.sh as
I have mentioned It's path in the script.