13MCA17 UNIX Programming Laboratory syllabus for MCA


Unit-1 UNIX Programming Lab 1 0 hours

1a. Write a shell script that takes a valid directory name as an argument and recursivelydescend all the sub-directories, finds the maximum length of any file in that hierarchy andwrites this maximum value to the standard output.b. Write a shell script that accepts a path name and creates all the components in that pathname as directories. For example, if the script is named mpc, then the commandmpc a/b/c/d should create directories a, a/b, a/b/c, a/b/c/d.

Unit-2 UNIX Programming Lab 2 0 hours

a. Write a shell script that accepts two file names as arguments, checks if the permissionsfor these files are identical and if the permissions are identical, output common permissionsand otherwise output each file name followed by its permissions.b. Write a shell script which accepts valid log-in names as arguments and prints theircorresponding home directories, if no arguments are specified, print a suitable error message.

Unit-3 UNIX Programming Lab 3 0 hours

a. Create a script file called file-properties that reads a file name entered and outputs itproperties.b. Write shell script to implement terminal locking (similar to the lock command). It shouldprompt the user for a password. After accepting the password entered by the user, it mustprompt again for the matching password as confirmation and if match occurs, it must lockthe keyword until a matchingpassword is entered again by the user, Note that the scriptmust be written to disregard BREAK, control-D. No time limit need be implemented forthe lock duration.

Unit-4 UNIX Programming Lab 4 0 hours

a. Write a shell script that accept one or more filenames as argument and convert all ofthem to uppercase, provided they exist in current directory.b. Write a shell script that displays all the links to a file specified as the first argumentto the script. The second argument, which is optional, can be used to specify in which thesearch is to begin. If this second argument is not present, the search is to begin in currentworking directory. In either case, the starting directory as well as all its subdirectories atall levels must be searched. The script need not include any error checking.

Unit-5 UNIX Programming Lab 5 0 hours

a. Write a shell script that accepts as filename as argument and display its creation time iffile exist and if it does not send output error message.b. Write a shell script to display the calendar for current month with current date replaced by* or ** depending on whether the date has one digit or two digits.

Unit-6 UNIX Programming Lab 6 0 hours

a. Write a shell script to find a file/s that matches a pattern given as command line argumentin the home directory, display the contents of the file and copy the file into the directory~/mydirb. Write a shell script to list all the files in a directory whose filename is at least 10characters. (use expr command to check the lenght)

Unit-7 UNIX Programming Lab 7 0 hours

a. Write a shell script that gets executed displays the message either “Good Morning” or“Good Afternoon” or “Good Evening” depending upon time at which the user logs in.b Write a shell script that accept a list of filenames as its argument, count and reportoccurrence of each word that is present in the first argument file on other argument files.

Unit-8 UNIX Programming Lab 8 0 hours

a. Write a shell script that determine the period for which a specified user is working onsystem and display appropriate message.b Write a shell script that reports the logging in of a specified user within one minute afterhe/she login. The script automatically terminate if specified user does not log in during aspecified period of time.

Unit-9 UNIX Programming Lab 9 0 hours

a. Write a shell script that accept the file name, starting and ending line number as anargument and display all the lines between the given line number.b. Write a shell script that folds long lines into 40 columns. Thus any line that exceeds40 characters must be broken after 40th, a “\\” is to be appended as the indication of foldingand the processing is to be continued with the residue. The input is to be supplied through atext file created by the user.

Unit-10 UNIX Programming Lab 10 0 hours

a. Write an awk script that accepts date argument in the form of dd-mm-yy and displays itin the form if month, day and year. The script should check the validity of the argument andin the case of error, display a suitable message.b.Write an awk script to delete duplicated line from a text file. The order of theoriginal lines must remain unchanged.

Unit-11 UNIX Programming Lab 11 0 hours

a.Write an awk script to find out total number of books sold in each discipline as wellas total book sold using associate array down table as given below. Electrical l34 Mechanical l67 Electrical l80 Computer Science 43 Mechanical l65 Civil 98 Computer Science 64b.Write an awk script to compute gross salary of an employee accordingly to rule givenbelow.If basic salary is < 10000 then HRA=15% of basic & DA=45% of basicIf basic salary is >=10000 then HRA=20% of basic & DA=50% of basic.

Last Updated: Tuesday, January 24, 2023