Skip to main content

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:

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
final errors taking are:

/usr/local/freesurfer/subjects/rhsr/data_temp: permission denied.
foreach: end not found.

help??

quote posted aytacd view post
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:

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
final errors taking are:

/usr/local/freesurfer/subjects/rhsr/data_temp: permission denied.
foreach: end not found.

help??
after seconds of googling, found man page tcsh, , section 'foreach' leads me believe tcsh means when says "foreach: end not found".


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk for / foreach loop in tcsh?


Ubuntu

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support