Write shell scripts to accomplish the following system admin

Write shell scripts to accomplish the following system administration tasks:

a). MyExecutables: List all the executable files in the current working directory.

b). MyFiles <username> <directory>: Check the following attributes of a file in the specified directory:

1). Read permission

2). Write permission

3). Execute permission

4). Ordinary or special file

5). Check if the file exist

6). Check if there is anything contained in the file

7). Check if the file is a directory

The appropriate response must be provided for each of the above attributes.

c).Find out the biggest number from three given numbers. The numbers must be supplied as command line argument and an error must be printed if sufficient arguments are not supplied.

Notes

a). Ensure appropriate comments are within each script.

b). Each script with the associated output should be submitted.

Solution

This command finds all the execuable files in the current working directory.

find . -perm -111 -type f

1)

if test -r \"Newfile.sh\"
then
echo \"File Readable\"
fi

outout: File Readable

replace -r in above expression with

-w, to test write permission

-x, to test executable permission

! -f, to test if it\'s a special file

-e, to test if file exists

! -s, to test if file has contents

-d, to test if a file is a directory.

c) find maximum

if [ $1 -gt $b -a $1 -gt $3 ]
then
echo \"$1 is Greatest\"
elif [ $2 -gt $c -a $b -gt $1 ]
then
echo \"$2 is Greatest\"
else
echo \"$3 is Greatest!\"
fi

Write shell scripts to accomplish the following system administration tasks: a). MyExecutables: List all the executable files in the current working directory.
Write shell scripts to accomplish the following system administration tasks: a). MyExecutables: List all the executable files in the current working directory.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site