Starting from:
$30

$24

CSE 333 - OPERATING SYSTEMS Programming Assignment # 1

    1. (15 pts) Write a shell script that takes two command line arguments, first one being a string and the second one being a number. The number has to have a length of either 1 or same as the string. Your program should then convert the input string into a ciphered one using this number. For each letter in the string, your program has to find another letter in the English alphabet advancing over the alphabet corresponding digit times. For example:

Ex:

    • ./myprog1.sh apple 12345 brspj

Since b is one after a, r is two after p and so on. If the number has only one digit, then this digit will be used for all the letters in the string.

Ex:

        ◦ ./myprog1.sh zoo 8 hww

    2. (25 pts) Write a shell script that takes a filename as parameter. Then your program will create a story copying one line from each one of the files named giris.txt, gelisme.txt, sonuc.txt randomly in that order and print them to the file whose name is the argument given to the program. If the file exists, ask user if she wants the file to be overwritten. The aforementioned files are given to you with the project description file.

Ex:

$ ./myprog2.sh story1.txt
story1.txt exists. Do you want it to be modified? (y/n): y A random story is created and stored in story1.txt.

$ cat story1.txt

Yardimsever bir arkadasimla bir gun kirlarda gezerken kozasindan cikmaya calisan bir kelebek gorduk.

Bu ulkede kral ve kralice halka hizmet eder, cok sevilirmis. Bu ulkede bir de Prens ve Nilufer Prenses varmis.

Deyimlerimizin ortaya cikis hikayelerini bilmek dilimizin kulture yansiyan yuzune renk katarak dusunce ve olaylari karsilastirmamizda etkilidir.

    3. (20 pts) Write a shell script that moves all the files with write permission for user to a directory named writable. This directory will be created under current working directory by your program.

Ex:

    • ls -l total 2328
-rwx------ 1 std std 152144 Jun 20 2005 alice-in-wonderland.txt -rw------- 1 std std 82140 Jun 20 2005 barleby-scrivener.txt -rw------- 1 std std 13421 Jun 20 2005 calaveras-county.txt -r---w---- 1 std std 13107 Jun 20 2005 cask-of-amontillado.txt -rw------- 1 std std 635 Jun 20 2005 french.txt
-rw-------
1
std
std 496769
Jun 20 2005 hawthorne.txt
-rw-------
1
std
std 172541
Jun 20 2005 looking-glass.txt
drwx------
14 std std 476 May 25 2007 shakespeare
-r--------
1
std
std 192710
Jun 20 2005 song-of-hiawatha.txt
-rw-------
1
std
std 35238 Jun 20 2005 trees-and-other-poems.txt
$ myprogr3.sh



7 files moved to
writable directory.

    4. (15 pts) Write a shell script that takes an integer argument. Then your program should find the hexadecimal values for all prime numbers that are smaller than the argument.

Ex:

        ◦ ./myprog4.sh 30 Hexadecimal of 2 is 2 Hexadecimal of 3 is 3 Hexadecimal of 5 is 5 Hexadecimal of 7 is 7 Hexadecimal of 11 is B Hexadecimal of 13 is D Hexadecimal of 17 is 11 Hexadecimal of 19 is 13 Hexadecimal of 23 is 17 Hexadecimal of 29 is 1D

    5. (25 pts) Write a shell script that takes a wildcard as an argument and a pathname to a directory as an optional argument. If the user supplies only wildcard as an argument, then the program will ask user to delete every file whose name obeys the wildcard under current directory. If the user supplies both wildcard and pathname, then the program will ask user to delete every file whose name obeys the wildcard under the given directory and all of its subdirectories.

Ex:

    • ls -l total 2328
-rwx------ 1 std std 152144 Jun 20 2005 alice-in-wonderland.txt -rw------- 1 std std 82140 Jun 20 2005 barleby-scrivener.txt -rw------- 1 std std 13421 Jun 20 2005 calaveras-county.txt -r---w---- 1 std std 13107 Jun 20 2005 cask-of-amontillado.txt -rw------- 1 std std 635 Jun 20 2005 french.txt

-rw------- 1 std std 496769 Jun 20 2005 hawthorne.txt
-rw------- 1 std std 172541 Jun 20 2005 looking-glass.txt drwx------ 14 std std 476 May 25 2007 shakespeare -r-------- 1 std std 192710 Jun 20 2005 song-of-hiawatha.txt

-rw------- 1 std std 35238 Jun 20 2005 trees-and-other-poems.txt
    • ls -l shakespeare

-rw------- 1 std std 13678 Jun 20 2005 shakespeare.txt
    • myprogr5.sh s*

Do you want to delete song-of-hiawatha.txt? (y/n): y 1 file deleted
    • myprogr5.sh s* .
Do you want to delete shakespeare/shakespeare.txt? (y/n): y 1 file deleted


Notes:

You are required to consider all necessary error checking for the programs. No late homework will be accepted.
In case of any form of copying and cheating on solutions, all parties will get ZERO grade. You should submit your own work. In case of any forms of cheating or copying, both giver and receiver are equally culpable and suffer equal penalties.
You have to work with a partner or two. Your partner(s) will not be changed throughout the semester.

Your report should include explanations about implementations with screenshots of your sample executions. Your implementation detail should be provided in the source code comment.

Please put your COMMENTED source codes and project report in a zip file and

make    sure    that    your    zip    file    name    contains    your    student    IDs!

Ex: 150713852_150713853_Project1.zip

IMPORTANT

Your project will be graded with a auto grader. Here are the rules you should follow for the auto grader to correctly grade your programs:

    a. You have to write your programs in separate shell files. The names of yourshell programs should follow the examples above. (myprog1.sh, myprog2.sh, etc.)

    b. You should not put any spaces for the name of your programs and zip file.
    c. You should not use Turkish characters anywhere. (In the programs or as filenames.)
    d. When extracted, make sure that your 5 programs are directly under the extracted directory (the extracted directory should not contain any subdirectory).

    e. The arguments to the programs should be given exactly as in the examples above.

    f. Your programs should do all changes in their current working directory only. Do not make any changes in any other places!

    g. Your programs should make only the requested changes and nothing more.
    h. If your program does not follow these rules, then you will not get a grade for violating rules.

More products