I have tryed to make a background process but iam not sure about that is working or not. Or that should it be implement this way ??

cmd &
cmd > file &
cmd < file &
cmd | cmd &



Code:
/***************************************************************************
 *                                                                         *
 *Eksempletet viser en shell der skal vise brug af pipe og background processr*
 *												   *
 ***************************************************************************/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>


/* The following define's belongs to read_command&#40;..&#41; */
#define MAXPARMS	20
#define MAXPARMLEN	255
#define MAXINPUT	255
#define shell		"cesh"

/* for pwd command*/
#define SIZE		200

/* The Command line parser */

/*------------------------------------------------------------------*/
/* read_command&#58;                                                    */
/*   Print the prompt and get one characters from the users which   */
/*   makes up an entire command line entry                          */
/*------------------------------------------------------------------*/

void read_command&#40;char * command, char * parameters&#91;&#93;&#41;
&#123;
  char input&#91;MAXINPUT&#93;;
  char * parm;
  char c;
  int i;

  /* initialize the whole parameters array to NULL pointers */
  for &#40;i=0;i<MAXPARMS;i++&#41;
    &#123;
      parameters&#91;i&#93;=NULL;
    &#125;

  i=0;
  input&#91;0&#93;='\0';

  /* loop until some characters are entered on the command line */
  do
    &#123;
      printf&#40;"%s> ", shell&#41;;
      c=getchar&#40;&#41;;
      while &#40;&#40;c != '\n'&#41; && &#40;i < MAXINPUT-1&#41;&#41;
        &#123;
          input&#91;i&#93;=c;
          i++;
          c=getchar&#40;&#41;;
        &#125;
      input&#91;i&#93;='\0';
    &#125; while &#40;strlen&#40;input&#41;==0&#41;;

  /* copy the first "word" on the command line into the command var */
  /* this also initializes the use of the strtok function */
  strcpy&#40;command, strtok&#40;input, " "&#41;&#41;;
  parameters&#91;0&#93;=malloc&#40;&#40;MAXPARMLEN+1&#41;*sizeof&#40;char&#41;&#41;;
  strcpy&#40;parameters&#91;0&#93;, command&#41;;
  i=1;

  /* separate all of the "words" on the command line. Each becomes */
  /* a string pointed to by the parameters array using strtok. */
  do
    &#123;
      if &#40;parm=strtok&#40;NULL, " "&#41;&#41;
        &#123;
          parameters&#91;i&#93;=malloc&#40;&#40;MAXPARMLEN+1&#41;*sizeof&#40;char&#41;&#41;;
          strcpy&#40;parameters&#91;i&#93;,parm&#41;;
        &#125;
      else
        &#123;
          parameters&#91;i&#93;=NULL;
        &#125;
      i++;
    &#125; while&#40;&#40;parameters&#91;i-1&#93;!=NULL&#41; && &#40;i < MAXPARMS&#41;&#41;;

  return;
&#125;

/*
Test of Command line parser&#58;
	Enter a command line with parameters and see the line seperated in pure
	command and an array of pointers to all the "words" of the complete
	command line.
*/




int main&#40;void&#41;
&#123;
char name&#91;10&#93;;
char *argv&#91;MAXPARMS&#93;;
int i;
int PID, status;
int BGRND = 0;

read_command&#40;name, argv&#41;;


/*background process*/

if &#40;&#40;strcmp&#40;name, "back"&#41;==0&#41; & &#40;strcmp&#40;argv&#91;1&#93;, "&"&#41;==0&#41;&#41;

&#123;
	BGRND = 1;

	if &#40; &#40;PID = fork&#40;&#41;&#41; < 0 &#41;
			return 0;

	if&#40;PID == 0 &#41;
	&#123;
		if &#40;&#40;execvp&#40;argv&#91;1&#93;, argv&#41;&#41; == -1&#41;
			perror&#40;"Fejl"&#41;;
			//printf&#40;"%s&#58; Command not found.\n", tokenstr&#41;;
			return 0;
	&#125;
	if&#40;BGRND == 0&#41;
	&#123;
		while &#40;waitpid&#40;-1, &status, 0&#41; != PID&#41;;
	&#125;
	BGRND = 0;

&#125;

return 0;

&#125;