Week 5 Individual Assignment
Words: 550
Pages: 2
64
64
DownloadTo:
From:
Date:
Linux Script 1
#!/bin/sh#Display the date
getDate(){
date return }
info=$(uname -a)
date=$(getDate)
user=$(id)
echo The Current Date is $date
echo Username and Id: $user
echo System Information: $info
echo Our Current Working Directory is $PWD
Output results are as shown below
centertop
Linux Script 2
#!/bin/bash
getDate(){
date return }
theDate=$(getDate)
info=$(uname -a)
user=$(id)
cd /tmp #search for ‘Mary’ in /etc/passwd name=’Mary’
search=$(grep $name /etc/passwd)
if [ $? -eq 0 ] then echo $name is a user in the system
else echo $name is not a user in the system
fi #display date
echo The Date is $theDate #display system information
echo System Information $info
#display user id
echo $user
#display current directory
echo Current Directory is $PWD
Output Source is as follows:
centertop
Linux Script 3
#! /bin/bash
getDate(){
date return }
hostname=$(hostname)
theDate=$(getDate)
args=(“$@”)
size=${#args[@]}
if [ “$size” -lt 2 ]
then echo You need to enter two arguments
exit 64
elif [ “$size” -gt 2 ]
then echo You need to enter two arguments
exit 64
elif [ “$size” -eq 2 ]
then echo ${args[1]} ${args[0]}
fi #display date
echo $theDate #display username
echo $USER
#display hostname
echo $hostname
Output is as follows:
251642-76352
Linux Script 4
#!/bin/bash
getDate(){
date return }
theDate=$(getDate)
users=$(who –count)
path=$PATH
echo a.
Wait! Week 5 Individual Assignment paper is just an example!
Windows
echo b. Linux
echo c. Mac OS
echo d. Chrome OS
read -p “Enter An Answer: ” choice
case $choice in
“a”) echo “Windows is the most popular OS in the world.”;;
“b”) echo “Linux is the preferred choice for most developers.”;;
“c”) echo “Mac OS is like a child of Windows and Linux :D.”;;
“d”) echo “An entry into the Os market. Seems to be promising.”;; *) echo “Please choose one of the options.”;; esac #Display The Current Date and Time
echo $theDate #Display The Number of Users
echo $users
#Display Path Files
echo $path
00
00
References
Siever, E., Weber, A., Figgins, S., Love, R., & Robbins, A. (2005). Linux in a Nutshell. ” O’Reilly Media, Inc.”.
Subscribe and get the full version of the document name
Use our writing tools and essay examples to get your paper started AND finished.