LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-07-2006, 02:23 PM   #31
studentlb
Member
 
Registered: Oct 2006
Posts: 53

Rep: Reputation: 15

Still the redirection not working with me :'(
Pls i need some help
 
Old 11-07-2006, 11:24 PM   #32
Francinoman
LQ Newbie
 
Registered: Sep 2006
Posts: 13

Rep: Reputation: 0
So what parts of the shell do you have working at the moment? Do you understand what you have done so far?

maybe paste the code so we can look and help with the redirection from there? Because your description of the project didnt appear to need redirection from what i seen?
 
Old 11-08-2006, 02:47 AM   #33
ptlchetan
Member
 
Registered: Aug 2006
Posts: 35

Rep: Reputation: 15
hi

try use
ncurses.h and history.h
u get all your required functions and facility to achive your functional goal

regards
sheladiya
 
Old 11-08-2006, 09:32 AM   #34
studentlb
Member
 
Registered: Oct 2006
Posts: 53

Rep: Reputation: 15
HERE IS WHAT I DID TILL NOW:
(EXECUTE A USER COMMAND)

int main(int argc,char **argv){
pid_t pid; int status,nc;
char *buf; char **args;
buf=(char *)malloc(1024);
while (1){
printf("myShell$");fflush(stdout);
nc=read(0,buf,1024); args=parse(buf);
buf[nc-1]=0;pid=fork();
if(pid==0){
execvp(args[0],args);
printf("execvp failed\n");
}
else {
wait(&status);free(args);
char ** parse(char *buf)
{
int count=0;char **argv;
argv=(char **)malloc(1024);
argv[count]=buf;
while(*buf!=0){
if(*buf==' ') {
*buf=0;count++;
argv[count]=buf+1;
}
buf++;
}
argv[count+1]=0;
return argv;


IT WORKED
i m working on the redirection and i need some help
 
Old 11-10-2006, 03:24 AM   #35
studentlb
Member
 
Registered: Oct 2006
Posts: 53

Rep: Reputation: 15
Please can anybody help !!!
 
Old 11-22-2006, 04:39 AM   #36
studentlb
Member
 
Registered: Oct 2006
Posts: 53

Rep: Reputation: 15
is it creating children the best way to combine the parts together ???
I m done with each part apart
 
Old 12-02-2006, 03:50 AM   #37
chemichael
Member
 
Registered: Aug 2005
Location: Tucson, Arizona
Distribution: PCLinuxOS
Posts: 128

Rep: Reputation: 15
http://www.linuxcommand.org/writing_shell_scripts.php
 
Old 12-03-2006, 01:11 PM   #38
studentlb
Member
 
Registered: Oct 2006
Posts: 53

Rep: Reputation: 15
Thanks chemichael
 
Old 02-26-2009, 05:06 AM   #39
ko589
LQ Newbie
 
Registered: Feb 2009
Posts: 8

Rep: Reputation: 0
implementing 'cd' command

Im suppose to implement the cd command but don't really understand the coding behind it. I understand that I'll be using fork() to create a child process which will basically execute the cd command. Now I can't figure out the code behind the 'cd' command. I really need some hints to start of !!
 
Old 02-26-2009, 07:29 AM   #40
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741
Please don't jump into old threads like this--especially when your question is not really related. Please start a new thread with your question.

This looks like homework--when you start a new thread, be sure to give the context of the question, and tell us what books you are using---what you have tried, etc.
 
  


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
Unix Shell Programming If Statement ']['HeBroken Programming 2 12-06-2004 03:21 PM
[c] unix systems programming in MS VS C++? saiz66 Programming 2 10-07-2004 08:16 AM
c programming in unix dilberim82 Programming 7 04-21-2004 04:32 PM
UNIX (Linux, BSD, etc) Programming :: UNIX kuphryn Programming 8 04-04-2004 11:50 PM
is there actually a market for Unix programming? ShawnD Programming 37 05-16-2003 04:16 PM

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

All times are GMT -5. The time now is 03:47 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
Open Source Consulting | Domain Registration