LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Closed Thread
  Search this Thread
Old 09-05-2006, 02:50 PM   #1
nsvikin
LQ Newbie
 
Registered: Sep 2006
Posts: 1

Rep: Reputation: 0
Unhappy Shell Assignment : Creating a CLI please help!


Hi guys,
I'm new to this forum and i've got an assignment to complete and would much appreciate any help on this matter.Let me post you the question:

Implement a command line interface which will execute all UNIX commands and save intermediate values of pipe (|) and redirection operation (>>) commands with the help of files related system calls and dup2. The program should work as follows
The program should provide a command interface with following features.
It should support internal commands like Start, End, LogComm, LogInt, UnLogComm, and UnLogInt. These commands are just to enable / disable various functionalities of the interface. They are not a part of UNIX system. The functionalities of these commands are as follows
Start -> start the functioning of your own interface
End -> Exit from your interface
LogComm -> Log all the commands executing in the command interface with status as success/failure.
LogInt -> Logs intermediate values of pipe or redirection commands in standard format specified
UnLogInt -> stop logging intermediate values of pipe and redirection commands
UnLogComm -> Stop logging commands executed in the interface.
The new command interface should support all the commands in UNIX system and should save the intermediate value of pipe and redirection commands into a file with the following format
ls –l | wc | wc
The intermediate output file (name of the file should be InterLog.txt) should print the output as follows
ls –l output is
[ls –l] drwxrwxrwx …………………………
[ls –l] –rwxr—r-- ……………………………
****************************************
ls –l | wc output is
[ls –l | wc]
****************************************
ls –l | wc | wc output is
[ls –l | wc | wc]
****************************************
If the LogComm is on then the system should create a file named CommLog.txt which will store information about all the commands executed in the system as follows
ls –l Success
ls –l | wc Success
ls –l | wc | wc Success
ls Success
ls >> a1.txt Success

The command interface should work as follows for redirection.
ls >> a1.txt
The intermediate file will store ls output alone. Where as a1.txt will contain information what it had earlier and the output of ls.

********************************************************

Well, that's it...I'm new to shell programming and have background in basic C data structures....Any help in coding will be much appreciated...

Thanking You,
Vikram
 
Old 09-05-2006, 03:10 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
we aren't here to do your work for you. you need to learn this for yourself, not abuse the good nature of our members. this thread is now closed. thanks.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: CLI Magic: Creating basic front ends with dialog and Xdialog LXer Syndicated Linux News 0 07-17-2006 09:21 AM
LXer: CLI Magic: Using command history in the bash shell LXer Syndicated Linux News 0 07-03-2006 12:54 PM
Help on creating CLI clihelp Programming 4 12-05-2005 02:48 PM
Creating and editing files with CLI TheDirtyPenguin Linux - Software 2 02-02-2005 12:15 AM
Shell Script assignment...need MAJOR help! slappydappy Programming 7 10-06-2003 02:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration