Problems in shell


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Problems in shell
# 1  
Old 12-02-2009
Problems in shell


hiiii

this is the first time for me here >>>

but really i have some problems for answers these things also understanding...

Can any one help me?



Write a simple shell as given in class. Your shell, called shell will read input lines from standard input, parse them into a command name and a set of zero or more arguments, and then start a new process running that command. The new process may be run in the foreground or in the background depending on the presence of an optional ‘&' at the end of the command line. When you start your shell, it shall provide a prompt and then wait for a command line of the form: Command arg1 arg2 arg3 . . . argk [&]

The shell must look for the command name (program name) in exactly /bin and /usr/bin directories, then starts the program with k arguments: "arg1", "arg2", "arg3", . . . and "argk".

3. You should become familiar with the Linux manuals and the online "man" facility. This will be a great help in working on your assignments. For example, if you wanted to know how the fork (create process) system call works, you would type:

man 2 fork
The Linux manual is organized into many sections. You will be mainly interested in the first three sections. Section 1 is for commands, like ls, g++, or cat. Section 2 is for Linux system calls (calls directly to the Linux kernel), such as fork, open, or read. The Linux library routines are in Section 3. These are calls such as atof, or strcpy.
Your shell program must loop (until exit command is found) waiting for a line of standard input. You should use the standard C++ stream classes for I/O. Each line has a command and zero or more arguments, as stated above. Each of these items is separated by one or more blank characters (spaces or tabs). Your shell must fork a child process and than overlay itself (exec) the program matching the command name. The shell's parent process defaults to waiting for the child process. Optionally, at the end of any command input, can be a "&" character, which means that the parent process does not wait for the child process to complete before prompting for the next command
# 2  
Old 12-02-2009
first off, homework questions are often closed as the rules say "no homework"

second, dont ask for the answer, its better to show us what you have so far...


have you used man command at all?
have you read man fork ?
what version of unix do you have?
# 3  
Old 12-02-2009
hello bro....

no this is the first hw in this course operating system

we take a little info about fork not match

i am using cygwin not unix

do me faver plz .......

plz if you have any good slides about this topic tell me

or pdf...... i prefer slides

thanxx so mach

best wishes

Ronald
# 4  
Old 12-03-2009
All homework has to be posted in the Homework & Coursework Forum, subject to the rules for posting homework.

Thread closed.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problems with a crontab shell

Hi everyone, can you help me ?, I have the following shell: DIR="/backups/backdata" DIR_2="/BACKOPENF/database" LOG="/backups/logs/oracle_backup.log" EXP_LOG="/backups/logs/Exp`date +%Y%m%d%H%M%S`.log" EXP_FILE="Exp`date +%Y%m%d%H%M%S`.dmp" HOLD_DAY=1 # String de conexion... (4 Replies)
Discussion started by: Manolo
4 Replies

2. Shell Programming and Scripting

Shell Script Problems

Hi, I'm newbie in the shell script world and i want to solve some problems I am experiencing. My main goal is to create a ksh script to use 2 text files as input to execute a local shell script(create user commands in the criar.users.aix file) through a ssh connection in which the list of... (1 Reply)
Discussion started by: joaochambino
1 Replies

3. Shell Programming and Scripting

Korn Shell Loop Problems

Very new to the Korn Shell, but I've been looking up loops online and it seems this should work. I'm just trying to convert an ip range in variables $A and $B and iterate the individual ip's out to new lines. Unfortunately I get {152..155} instead of 152, 153, 154, and 155. # for i in {$A..$B};... (8 Replies)
Discussion started by: Azrael
8 Replies

4. Shell Programming and Scripting

Two problems when I am writing my own shell

Hi, guys: I am writing my own shell using c. I meet with two problems. First, when I use tcsetpgrp system call to move a background job to foreground, when this job finishes, my shell program also exit. What is the problem for that? Second, when I use signal , if the child has its own... (1 Reply)
Discussion started by: tomlee
1 Replies

5. UNIX for Dummies Questions & Answers

Problems in shell script if sed is used

Hi All, Below is the script which i have written in cygwin: #!/usr/bin/sh fname=$1 cat $fname | sed 's/ //g' > fname1 for i in `cat $fname1` do echo $i > file1 #param1 is script name param1=`awk -F , '{print $1}' file1` param1="$param1.sql" #param2 is BL param2=`awk -F , '{print... (5 Replies)
Discussion started by: janardhanamk
5 Replies

6. Shell Programming and Scripting

Shell code problems

So I have a line that is suppose to find all files in a folder and then run a program through all the files and then output the files with a _.txt ending. find ./ -name '*' -exec sh -c 'intersect-by-ids -ff {} -fc 1 -if normed_occ.txt -ic 1 \> {}_.txt'\; the error that i get is "find: missing... (2 Replies)
Discussion started by: kylle345
2 Replies

7. Shell Programming and Scripting

Shell variables problems

hi, i need some help, the situation is this 1-file of variable enviroments DIR1=/tmp DIR2=otherdir/mydir 2-file of list of files (all the names references whic variables of first point) ${DIR1}/${DIR2}/onefile Well now i create a shell script whic... (5 Replies)
Discussion started by: chipcmc
5 Replies

8. Solaris

Problems with korn shell script

Hey Guys, I'm looking for some advice about a korn shell script I've written. I've spent hours googling for an answer hopefully someone here can help me out. Basically the part of the script I'm having problems with is when I need to SFTP a file from one server to another. The line looks... (6 Replies)
Discussion started by: hilather
6 Replies

9. Shell Programming and Scripting

Shell script problems to do

Does anyone know a good site to do shell script problems? (0 Replies)
Discussion started by: cleansing_flame
0 Replies

10. Shell Programming and Scripting

C Shell problems

I am a newbies here and also dummies in csh language. I've been told from my frenz this forum is very useful site for Q&A about UNIX script. Can anyone in here just lead me to learn more about csh language with code example. tq (3 Replies)
Discussion started by: unknown2205
3 Replies
Login or Register to Ask a Question