🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #1521

Re: ayuda con shell scripting

#1521
From: slinux
Date: Fri, 14 Oct 2005 17:02
36 lines
1950 bytes
siguiendo con la shell...como puedo lanzar procesos en segundo plano ('&') y  utilizar varios comandos en una l�nea (';')


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

int main()
{
char linea[34421];
while (fgets(linea�34421�stdin)) {
pid_t pid;
if (pid=fork()) { if (pid0) wait(0); }
else {
char *palabras[17210]�*s=linea; int i=0;
while (palabras[i++]=strtok(s� � \t\n")) { s=0; }
execvp(palabras[0]� palabras); exit(1);
}
}
return 0;
}

gracias


-- 
slinux 

------------------------------------------------------------------------
Ver este tema: http://www.softwaremix.net/viewtopic-422766.html

Enviado desde http://www.softwaremix.net
Technical Details
Message-ID: <slinux.1wwrew@no-mx.softwaremix.net>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.ya.com!news.ya.com.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,dadc88db62ffb8d9
X-Google-Attributes: gidf86c8,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.ya.com!news.ya.com.POSTED!not-for-mail
NNTP-Posting-Date: Fri, 14 Oct 2005 15:03:50 -0500
From: slinux <slinux.1wwrew@no-mx.softwaremix.net>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: ayuda con shell scripting
Date: Fri, 14 Oct 2005 19:02:03 +0200
Message-ID: <slinux.1wwrew@no-mx.softwaremix.net>
Organization: Softwaremix.net
User-Agent: Punbb USENET gateway
X-Newsreader: Punbb USENET gateway
X-Originating-IP: 80.224.176.74<3le2m2F11ptbkU1@individual.net>
Lines: 2
NNTP-Posting-Host: 70.85.210.130
X-Trace: sv3-dnww+BF/rFKCo7uIKsxBo+cxvmpX/HZnvjeQtK5/ldtCbi0S8gwl/ubEdMgdLYw02HJHQBg3EzF2lqr!G6tqTWnuo9Ol4W58O+6bY9UNt0hMDe5SSmFUq8JbmCGfhqeAnhtOon3w5j5XqoAxg5FJUQ==
X-Complaints-To: abuse@ya.com
X-DMCA-Complaints-To: abuse@ya.com
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32