Reputation: 109
I have a function called fslnvols which gives the number of images in a 4D image.
Usage:
fslnvols <input>
I wanted to save the output of the function to variable A,so I tried:
A=fslnvols inputimage
and
fslnvols inputimage
A=$(fslnvols)
but I didn't get the wanted result, any idea how to fix it?
Upvotes: 1
Views: 445
Reputation: 42137
Use command substitution, $()
:
A=$(fslnvols inputimage)
The command whose output you want to store as variable A
, goes inside $()
-- fslnvols inputimage
in this case.
Upvotes: 2