LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 08-05-2004, 04:01 PM   #1
pony85
LQ Newbie
 
Registered: Aug 2004
Location: Bangalore
Distribution: Redhat Linux 9.0
Posts: 25

Rep: Reputation: 15
Linux shell development


Hello everyone

could you please help me out with a project related to operating systems...
i plan to create our own shell in linux.. with a few functions
but dont know how to implement it...
could u please help!!

I know linux, and C and C++ prog
with a course in datastructures,ada
 
Old 08-05-2004, 04:22 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
All a shell does is display a prompt, wait for the user to type in a command, and performs the operation. It's just a simple user input loop. To demonstrate what I mean, here is some very simple code:

Code:
#include <stdio.h>

int main( void )
{
  char user_command[256];

  repeat
  {
    printf( "prompt> " );
    scanf( "%s", user_command );

    if( strcmp( user_command, "action1" ) == 0 )
      perform_action1();

    if( strcmp( user_command, "action2" ) == 0 )
      perform_action2();

    ...

  } while ( strcmp( user_command, "quit" ) != 0 )

  return 0;
}
That code is very primitive, but it demonstrates what I'm talking about. You would need to add some way for the shell to interpret/parse the user's command, then perform some action(s) based on it, and probably organize things a little better than a simple series of if statements.

=========================

Double-posting is against the rules. The thread in the programming forum can be found here:
http://www.linuxquestions.org/questi...hreadid=213903

Last edited by Dark_Helmet; 08-05-2004 at 04:25 PM.
 
Old 08-05-2004, 04:28 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php


http://www.linuxquestions.org/questi...hreadid=213903



Cheers,
Tink
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
C++ or pure C for Linux kernel module, Linux device driver development. What to use? Igor007 Programming 91 07-19-2014 12:55 PM
Linux Development AndrewB Mandriva 4 03-21-2005 07:04 PM
Overview of Linux development? plnelson Programming 16 10-15-2004 07:57 PM
Linux shell development pony85 Programming 3 08-05-2004 11:04 PM
Linux Development p1az Linux - General 1 10-16-2003 12:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:40 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration