Thread: for / foreach loop in tcsh?
hello all,
have loop accesing files in folder, convert them format (.mgz) , save them folder.
here algorithmic steps:
read list of files in folder.
convert file extensions (.mgz)
save files different folder.
here code used in bash script:
code:#!/bin/bash cd /usr/local/freesurfer/subjects/$1/data_temp temp=1; in $(ls); mri_convert $i 00$temp.mgz let temp=temp+1; done
have write in tcsh after hours of googling have found insufficient documentation foreach command:
final errors taking are:code:#!/bin/bash cd /usr/local/freesurfer/subjects/$1/data_temp set count=1 foreach ( ` /usr/local/freesurfer/subjects/$1/data_temp * ` ) foreach? echo $i foreach? mri_convert $i /usr/local/freesurfer/subjects/$1/mri/orig/00$count.mgz foreach? let count=count+1 foreach? done
/usr/local/freesurfer/subjects/rhsr/data_temp: permission denied.
foreach: end not found.
help??
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk for / foreach loop in tcsh?
Ubuntu
Comments
Post a Comment