source: trunk/LMDZ.COMMON/libf/evolution/deftank/modify_startfi_var.sh @ 3595

Last change on this file since 3595 was 3579, checked in by jbclement, 8 days ago

PEM:
Improvement of the Bash script tools in the deftank with an automatic error detection which ends the script with a message.
JBC

  • Property svn:executable set to *
File size: 903 bytes
Line 
1#!/bin/bash
2#######################################################################
3### Script to modify the value of a variable in a file "startfi.nc" ###
4#######################################################################
5set -e
6trap 'echo -e "\033[31mError: an issue occurred in the script on line $LINENO! Please review the command and try again.\033[0m"' ERR
7
8#######################################################################
9# Modify here the parameters for the script
10###########################################
11# Name of the file
12name_file="startfi.nc"
13
14# Name of the variable to be modified
15var_name="co2"
16
17# New value for the variable
18new_var=8.
19#######################################################################
20
21
22# Update the netCDF file
23ncap2 -O -s "$var_name=$new_var" \
24         $name_file $name_file
25
26echo "In \"$name_file\":"
27echo "New $var_name = $new_var"
28echo "Done!"
Note: See TracBrowser for help on using the repository browser.