Lancer un script d’un autre langage à partir d’un shell Script d’un autre langage:lancer à partir d’un shell

Objectif

Exécuter un script Perl et un script Python à partir d’un script shell.

Le script Perl

$ nl scriptperl.pl  
    1  #! /usr/bin/perl  
 
    2  print "Je suis un script Perl" ;  
    3  exit 0 ; 

Le script Python

$ nl scriptpython.py  
    1  #! /usr/bin/python  
 
    2  print "Je suis un script Python"  
    3  exit(0) 

Le script shell

$ nl test_scripts.sh  
 
    1  # Exécution du script Python  
    2  if scriptpython.py > /dev/null  
    3  then  
    4    echo "Script Python terminé avec succès"  
    5  else  
    6    echo "Script Python terminé avec échec"  
    7  fi  
 
    8  # Exécution du script Perl  
    9  if scriptperl.pl > /dev/null  
   10  then  
   11    echo "Script Perl terminé avec succès"  
   12  else  
   13    echo "Script Perl terminé avec échec"  
   14  fi 

Environnement

Dans notre exemple, les scripts possèdent...

couv_EI7PRO.png

Découvrez 

le livre :

Aussi inclus dans nos :

Précédent
Calculs
Suivant
Accéder à une base MySQL à partir d'un shell