0

I am trying to know the length of a variable 'i' in a netcdf file '122009.nc'. This is my script so far:

#!bin/bash
var=ncdump -v i 122009.nc
var_length=${#var}
Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
Jellyse
  • 223

1 Answers1

0

The line :

var=ncdump -v i 122009.nc  

needs to be:

var=$(ncdump -v i 122009.nc)

This will allow the result of the command to be read into var and later used to find the length