Changes between Version 5 and Version 6 of Documentation/UserGuide/ShellScript


Ignore:
Timestamp:
2020-05-11T16:38:38+02:00 (4 years ago)
Author:
aducharne
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/UserGuide/ShellScript

    v5 v6  
    11= How to write a shell script = 
    22Author: S.Luyssaert[[BR]] 
    3 Last revised: 2020/02/28, P. Maugis 
     3Last revised: 2020/02/28, P. Maugis; 2020/05/11, A. Ducharne 
    44 
    55== A super simple script for recurring tasks == 
     
    1111}}} 
    1212 
    13 Write the linux commands in the editor. Here, we selct 'bash' as the shell-interpreter. 
     13Write the linux commands in the editor. Here, we select 'bash' as the shell-interpreter. 
    1414{{{ 
    1515#!/bin/bash 
     
    2323 
    2424You can now type ''./clean.sh'' to execute the linux commands from the file 'clean.sh' 
     25 
     26== An example with a loop 
     27 
     28You have installed two versions of ORCHIDEE and you want to compare the sources with diff. 
     29This is done by the following script (written for bash): 
     30 
     31{{{ 
     32#!/bin/sh 
     33 
     34ref =$workdir/trunkv1/modipsl/modeles/ORCHIDEE 
     35test=$workdir/trunkv2/modipsl/modeles/ORCHIDEE 
     36 
     37for src in parallel global driver stomate parameters sechiba 
     38do 
     39 
     40 echo '********************' 
     41 echo $ref 
     42 echo $test 
     43 echo DIFF src_$src 
     44 echo '********************' 
     45 
     46 cd $ref/src_$src 
     47 for xx in `ls *.f90` 
     48 do 
     49  echo $xx 
     50  diff -r $xx $test/src_$src/$xx 
     51  echo '------------------------' 
     52 done 
     53 
     54done 
     55