wiki:Documentation/UserGuide/ShellScript

Version 1 (modified by dsolyga, 12 years ago) (diff)

--

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