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 | ####################################################################### |
---|
5 | set -e |
---|
6 | trap '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 |
---|
12 | name_file="startfi.nc" |
---|
13 | |
---|
14 | # Name of the variable to be modified |
---|
15 | var_name="co2" |
---|
16 | |
---|
17 | # New value for the variable |
---|
18 | new_var=8. |
---|
19 | ####################################################################### |
---|
20 | |
---|
21 | |
---|
22 | # Update the netCDF file |
---|
23 | ncap2 -O -s "$var_name=$new_var" \ |
---|
24 | $name_file $name_file |
---|
25 | |
---|
26 | echo "In \"$name_file\":" |
---|
27 | echo "New $var_name = $new_var" |
---|
28 | echo "Done!" |
---|
Note: See
TracBrowser
for help on using the repository browser.