I have an input directory (INPUT_DIRECTORY=${PWD}/INPUT
) and a directory for output to save files into it a bash command (OUTPUT_DIRECTORY=${PWD}/Output
)
and a file (image-99.nii
) need to be written in the OUTPUT_DIRECTORY
. I have saved the file name with its basename into two variables (name=image-99.nii
and FILENAME=image-99
)
for FILE in ${INPUT_DIRECTORY}/*.nii; do
name="echo ${FILE##*/}"
FILENAME=$(echo "$name" | cut -f 1 -d '.')
....
How to concat OUTPUT_DIRECTORY
and FILENAME
in a way that the name becomes "image-99-N4.nii"
. I did the following command, but did not work
OUTPUTNAME="${OUTPUT_DIRECTORY}/${FILENAME}_N4.nii"
When I ~$ $OUTPUTNAME
, I am getting an error bash: /echo: No such file or directory
$OUTPUT_DIRECTORY
.PATH
, for example, that could easily break a script.