Quote:
Originally Posted by alpha_b_gamma
I understood the first line
But what is done by:
file_stem=`basename $file .nii.gz`
|
Here is a brief explanation. This line sets a variable called
file_stem and assigns a value which is the output of a command. Note the
backticks around the basename command: they bring to
command substitution that is the output of the command inside backticks is substituted and assigned to the file_stem variable.
Regarding the basename command, the syntax is
Code:
basename NAME [SUFFIX]
and it
prints NAME with any leading directory components removed. If specified (as in your example)
also remove a trailing SUFFIX.
Let me give you a little advice: you should definitively read some good tutorial about Shell Scripting, since your questions are very basic and they demonstrate you did not even consider to open and read a piece of documentation. Please, believe me: it's worth the effort, since shell scripting can spare a lot of time if used with awareness. This one should be a good starting point:
http://www.linuxcommand.org/tlcl.php. Hope this really helps!