wiki:Documentation/UserGuide/ShellScript

Version 2 (modified by nvuilsce, 12 years ago) (diff)

Name changed from ShellScript to HowTo/ShellScript

How to write a shell script

A super simple script for recurring tasks

We want to make a script that deletes all the history and restart files from ORCHIDEE so that we can run the next simulation within the same file structure. We will call the command 'clean'.

open an editor for the command name i.e. clean

emacs ../bin/clean.sh

Write the linux commands in the editor.

#!/bin/bash
rm -f ../Output/*_history.nc ../Restart/*_out.nc ../bin/output.txt

Save the file and change the permissions so the file can be executed

chmod +x clean.sh

you can now type 'clean.sh' to execute the linux commands in the file clean.sh