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

var=ncdump -v i 122009.nc

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.