Changes between Version 5 and Version 6 of Documentation/UserGuide/ShellScript
- Timestamp:
- 2020-05-11T16:38:38+02:00 (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Documentation/UserGuide/ShellScript
v5 v6 1 1 = How to write a shell script = 2 2 Author: S.Luyssaert[[BR]] 3 Last revised: 2020/02/28, P. Maugis 3 Last revised: 2020/02/28, P. Maugis; 2020/05/11, A. Ducharne 4 4 5 5 == A super simple script for recurring tasks == … … 11 11 }}} 12 12 13 Write the linux commands in the editor. Here, we sel ct 'bash' as the shell-interpreter.13 Write the linux commands in the editor. Here, we select 'bash' as the shell-interpreter. 14 14 {{{ 15 15 #!/bin/bash … … 23 23 24 24 You can now type ''./clean.sh'' to execute the linux commands from the file 'clean.sh' 25 26 == An example with a loop 27 28 You have installed two versions of ORCHIDEE and you want to compare the sources with diff. 29 This is done by the following script (written for bash): 30 31 {{{ 32 #!/bin/sh 33 34 ref =$workdir/trunkv1/modipsl/modeles/ORCHIDEE 35 test=$workdir/trunkv2/modipsl/modeles/ORCHIDEE 36 37 for src in parallel global driver stomate parameters sechiba 38 do 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 54 done 55