New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
#1485 (Unable to use add_key for multiple keys) – NEMO

Opened 9 years ago

Closed 9 years ago

Last modified 2 years ago

#1485 closed Bug (fixed)

Unable to use add_key for multiple keys

Reported by: timgraham Owned by: nemo
Priority: normal Milestone: 2015 release-3.6
Component: OCE Version: v3.6
Severity: Keywords: 2015 OPA v3.6
Cc:

Description

According to the makenemo help text it should be possible to add multiple keys using the following syntax:
./makenemo add_key "key_iomput key_mpp_mpi"

This results in the following error message (although makenemo continues to build the configuration without adding the keys):
./makenemo: line 203: [: key_iomput: binary operator expected

Commit History (1)

ChangesetAuthorTimeChangeLog
5144timgraham2015-03-11T16:51:28+01:00

Another fix required related to #1485

Change History (6)

comment:1 Changed 9 years ago by timgraham

I think this can be fixed by changing line 203 from:

[ ! -z $2 ] && { list_add_key=$2; export ${list_add_key}; }

to

[ ! -z "$2" ] && { list_add_key=$2; export ${list_add_key}; }

Similarly for line 208. I'm testing the change now.

comment:2 Changed 9 years ago by timgraham

  • Resolution set to fixed
  • Status changed from new to closed

The above syntax doesn't work if " " is passed as the argument. It ends up printing out all environment variables.

Instead the test needs to be:

[[ ! "$2" =~ ^\ +$ ]] && { list_add_key=$2; export ${list_add_key}; }

This checks that the string is not null and contains characters other than white space.

I've fixed this at r5142

comment:3 Changed 8 years ago by nicolasmartin

  • Keywords 2015 nemo_v3_6* added

comment:4 Changed 7 years ago by nemo

  • Keywords release-3.6* added; nemo_v3_6* removed

comment:5 Changed 7 years ago by nemo

  • Keywords release-3.6* removed

comment:6 Changed 2 years ago by nemo

  • Keywords OPA v3.6 added
Note: See TracTickets for help on using tickets.