CS3500 Lab1: Basic System Calls and Shell Scripting solution


Original Work ?


5/5 - (1 vote)

Note: Use CLI to run and display the output.

1. Write a shell script to list all of the directory files in a directory 2 marks

2. A password is said to be strong if it satisfies the following criteria:

1. It contains at least one lowercase English character.

2. It contains at least one uppercase English character.

3. It contains at least one special character. The special characters are:

4. Its length is at least 8.

5. It contains at least one digit.

Given a string, find its strength. Let a strong password is one that satisfies all above
conditions. A moderate password is one that satisfies first three conditions and has
length at least 6. Otherwise, password is week.
Write a shell script to check the strength of string. 3 marks

3. Write a C program to mimic the shell scripting. Name it as simple_shell.c.

Requirements of shell:

• While waiting for input, the shell should run continuously and display a prompt
(>). Full path of the current directory should also be visible in the prompt followed by
the “>” sign (ex: home/os/assignment_1>).

• Shell should read a line from input one at a time.
• After parsing and lexing the command, the shell should execute it.
• Shell should be able to implement the following commands.
• clear: clear the screen

• pwd: prints the current directory
• mkdir: creates a directory called “dir”
• rmdir: removes the directory called “dir”
• ls: lists files in the current directory such that the ls -l option also needs to
be supported.

• history: displays the last commands the user ran, with an offset next to
each command. Last commands can be stored in a file and may be displayed
to the user when the command is issued.
• exit: exits the shell
5 marks