Starting from:

$25

VE 280 Lab 1  Solved

                                                                

 A fun bash game BashCrawl (not mandatory)                      
A fun game that helps you get famaliar with Linux command.

 The game is attached in the files. See /bashcrawl . It has its README.It will be uploaded on Gitea soon. Have fun.

 

Ex1. Hiding Photos                                                                           
Related Topics: Linux.

  Kyon is thinking of moving his favourite Mikuru's photos from SOS Quantum Library sql/ to his own webserver webserver/ without being noticed.

"If Haruhi knows this, Haruhi will destory the world. We have to avoid this".

Yuki suggests Kyon to use command lines. So Kyon decides to implement a shell script to automate command line tasks. He may need these tasks:

 Create: create the working directory of the database and webserver, and initialize the database;

Dump: dump the data in the database into the webserver;

List: list all the files stored in the webserver;

Display: display the data in the webserver;

Destroy: remove the working directory of database and webserver.

 He has already implemented the skeleton of ex1.sh , but now he . There are 5 of such lines in the script that are marked as TODO comments:

1 # TODO: Replace this line with a linux command line.

 Please help him finish this script by replacing the TODO s with a Linux command line you learned from lecture.

1.    Create a directory named sql/ .

2.     Copy the file sql/database.txt to the directory webserver/ 3. List all files in directory webserver/ .

4.    Display webserver/database.txt in stdout .

5.    Remove the webserver/ and sql/ directories.

Testing
To test the script, please first make it executable by running:

 

Then, you can test the script by running the following commands and observe the results.

 

 

Ex2. Validating Password                                                                
Related Topics: loops, arrays, boolean, ASCII.

Miyamori Aoi is designing the wbsite for Musani Animation. When designing the register page, she plans to Write a function that checks whether the password that the user type in meets all the requirements below (or say it is valid):

 Contains at least 1 alphabetic characters;

Contains at least 1 numerical characters; Contains at least 1 non-alphanumeric characters. The max length of a password is 50 characters.

The function takes a password (an array of chars) as input, returns true if the password is valid and returns false if not.

 

Miyamori is busy with their new animation. Please help her implement the function.

Note: In fact, when writing a web page, we use Regular Expression to validate whether a password meets our requirement. We do not use C++ but we use JavaScript for web programming. For those interested, you can Google it yourself.

 

Example
Example input:

 

Example output:

 

 

Ex3. Flipping an image                                                                     
Related Topics: loops, arrays


More products