Sponsored Content
Full Discussion: Bash Programming
Top Forums Shell Programming and Scripting Bash Programming Post 302314089 by bumdeal2 on Thursday 7th of May 2009 10:52:47 AM
Old 05-07-2009
Bug Bash Programming

Write a Shell script to analyse the disk usage of students in a particular class.
The program should allow the user running the script to input the particular class name (group name) as an argument to the script.
The script should create a file called “logfile” in the home directory of the user running the script. The first line of logfile should contain the heading:
“List of members of class “classname” on “today's time and date
For each member of the class, the script should record in the logfile on separate lines:
The username
The total number of files in the student's home directory
The total disk space used by the student
The last line of the logfile should contain the total number of students found in the class.

The information which you need on usernames, groupnames and group id's is contained in two files.
The first file is /etc/group. This file has a line for each group (class) containing the following information:
groupnameSmilieassword:groupid:secondary members. The file uses colon : as a field separator.
The second file is /etc/passwd. This file has a line for each user containing the following information:
username:x:userid:groupid:comments:home directory:default shell. The file also uses colon : as a field separator.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Programming in ksh and not in bash

Hi all.... I was wondering if there is a lot of differences between /bash and ksh programming. Im learning about bash programming, but all what I had read in this forum, points me to learn more about ksh over bash. Is that right and why? Unfortunately, I can’t write ksh progs on my work,... (2 Replies)
Discussion started by: TARFU
2 Replies

2. Shell Programming and Scripting

help bash programming

how to i grep a keyword which ignore upper case or lower case. for an example : user enter CoUcH and the grep also can grep couch which in text.txt although upper or loever case is different .. how to do that ? any idea? (1 Reply)
Discussion started by: CheeSen
1 Replies

3. Shell Programming and Scripting

bash programming

how do you allow a user to input a particular group name as an argument?? thnx for your time. (2 Replies)
Discussion started by: bumdeal2
2 Replies

4. Shell Programming and Scripting

Bash time and programming

I have inherited a C++ program which does not manage it's memory at all. It has a whole bunch of 'new' variables without many deletes. I believe it was the programmers intent to let the OS clean up. Correct me if I am wrong, but I believe the unix/linux systems clean up after the program... (1 Reply)
Discussion started by: JDKunk
1 Replies

5. Shell Programming and Scripting

Example in Pro Bash Programming book problem

I am going through the examples in the book "Pro Bash Programing" which is quite a good book on bash programing. Just a word of warning about the example script called sa that simply shows command line arguments. In CentOS 5.5 there is a program called sa already on the system. Boy did that throw... (0 Replies)
Discussion started by: simusphere
0 Replies

6. Shell Programming and Scripting

Bash programming help

Hello all; I have little knowledge of bash programming, and I was wondering if you could help me out. I would like to create a bash script, as detailed below. process.sh is the bash script itself list.dl is a text file. In this text file, the first line is the directory from... (1 Reply)
Discussion started by: tehalexf
1 Replies

7. Homework & Coursework Questions

Bash Shell Programming assignment.

Please take a look I am stuck on step 4 1. The problem statement, all variables and given/known data: #!/bin/bash ### ULI101 - ASSIGNMENT #2 (PART A) - DUE DATE Wed, Aug 3, 2011, before 12 midnight. ###==================================================================================== ###... (13 Replies)
Discussion started by: almirzaee
13 Replies

8. Shell Programming and Scripting

ctrl-c in bash script - Programming

Hi All, I need to place a ctrl-c interrupt in a bash script, there is no other way, it has to be done :) can someone please advise how would I go about this? i want to use ctrl c in below code, after the code excution of just 1 min or 1sec java Cspsamp 111.19.5.172 7025 rd1... (6 Replies)
Discussion started by: aish11
6 Replies

9. Shell Programming and Scripting

Chunks of bash shell programming

I am going to provide a chunks of codes that I do not understand. Please help with them in a layman's terms. 1) ${DEBUG:-0} -------------------------------------------------------------------------- 2) print "${1}" ... (7 Replies)
Discussion started by: lg123
7 Replies

10. Linux

Bash Programming. Could anyone help me?

Hi! I'm new in bash programming and I need to make an script that reads a txt file line by line (every line is like "Name;FirstLastName;SecondLastName;Sex") and has to give every student 3 random marks, its average and add a counter if they are male/female and if they passed. I've been trying with... (4 Replies)
Discussion started by: HeartHacker
4 Replies
MKULZMA(8)						    BSD System Manager's Manual 						MKULZMA(8)

NAME
mkulzma -- compress disk image for use with geom_uncompress(4) class SYNOPSIS
mkulzma [-v] [-o outfile] [-s cluster_size] infile DESCRIPTION
The mkulzma utility compresses a disk image file so that the geom_uncompress(4) class will be able to decompress the resulting image at run- time. This allows for a significant reduction of size of disk image at the expense of some CPU time required to decompress the data each time it is read. The mkulzma utility works in two phases: 1. An infile image is split into clusters; each cluster is compressed using liblzma. 2. The resulting set of compressed clusters along with headers that allow locating each individual cluster is written to the output file. The options are: -o outfile Name of the output file outfile. The default is to use the input name with the suffix .ulzma. -s cluster_size Split the image into clusters of cluster_size bytes, 16384 bytes by default. The cluster_size should be a multiple of 512 bytes. -v Display verbose messages. NOTES
The compression ratio largely depends on the cluster size used. For large cluster sizes (16K and higher), typical compression ratios are only 1-2% less than those achieved with lzma(1). However, it should be kept in mind that larger cluster sizes lead to higher overhead in the geom_uncompress(4) class, as the class has to decompress the whole cluster even if only a few bytes from that cluster have to be read. The mkulzma utility inserts a short shell script at the beginning of the generated image, which makes it possible to ``run'' the image just like any other shell script. The script tries to load the geom_uncompress(4) class if it is not loaded, configure the image as an md(4) disk device using mdconfig(8), and automatically mount it using mount_cd9660(8) on the mount point provided as the first argument to the script. EXIT STATUS
The mkulzma utility exits 0 on success, and >0 if an error occurs. SEE ALSO
lzma(1), geom(4), geom_uncompress(4), md(4), mdconfig(8), mount_cd9660(8) AUTHORS
Maxim Sobolev <sobomax@FreeBSD.org> Aleksandr Rybalko <ray@ddteam.net> BSD
March 17, 2006 BSD
All times are GMT -4. The time now is 01:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy