[langage C] script shell
bobi14
Messages postés
67
Date d'inscription
Statut
Membre
Dernière intervention
-
dubcek Messages postés 18789 Date d'inscription Statut Contributeur Dernière intervention -
dubcek Messages postés 18789 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
Je souhaiterais exécuter un petit script shell (4 lignes) dans mon programme en C.
Je sais que l'on peut exécuter une commande de shell avec popen mais comment puis je faire avec un script de plusieures lignes?
Mon script shell possède une commande simple suivie d'une condition sur le résultat de cette commande....
Merci d'avance pour votre aide.
Je souhaiterais exécuter un petit script shell (4 lignes) dans mon programme en C.
Je sais que l'on peut exécuter une commande de shell avec popen mais comment puis je faire avec un script de plusieures lignes?
Mon script shell possède une commande simple suivie d'une condition sur le résultat de cette commande....
Merci d'avance pour votre aide.
A voir également:
- [langage C] script shell
- Langage ascii - Guide
- Classic shell - Télécharger - Personnalisation
- Script vidéo youtube - Guide
- Langage binaire - Guide
- Mas script - Accueil - Windows
3 réponses
Il faut passer à system le nom du script comme paramètre:
system("/path/nom_du_script");
popen cée un pineline avec le prog. appellant, pas system.
system("/path/nom_du_script");
popen cée un pineline avec le prog. appellant, pas system.
voir system
NAME
system - execute a shell command
SYNOPSIS
#include <stdlib.h>
int system(const char *command);
DESCRIPTION
system() executes a command specified in command by calling /bin/sh -c command, and returns after the command has been completed. During execution of the command, SIGCHLD will be blocked, and SIGINT and SIGQUIT will be ignored.
NAME
system - execute a shell command
SYNOPSIS
#include <stdlib.h>
int system(const char *command);
DESCRIPTION
system() executes a command specified in command by calling /bin/sh -c command, and returns after the command has been completed. During execution of the command, SIGCHLD will be blocked, and SIGINT and SIGQUIT will be ignored.