AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
April 13, 2021 04:38PM
Hi, Kyrie-

I made a simplified form of that, which can run the AFNI_data6/FT_analysis/FT/ directory of our Bootcamp data; you can run it there for comparison.

First, I made a text file kind of like yours:
The file "test_file.txt" can be made with:
echo "r1" > test_file.txt
echo "r2" >> test_file.txt
echo "r3" >> test_file.txt
Then I ran:
#!/bin/tcsh

set sublist = (`cat test_file.txt`)

foreach sub ($sublist)
	echo "You are on sub $sub"
        \ls FT*${sub}*HEAD
end
... and that worked for me without error, outputting:
You are on sub r1
FT_epi_r1+orig.HEAD
You are on sub r2
FT_epi_r2+orig.HEAD
You are on sub r3
FT_epi_r3+orig.HEAD

One thing it might be worth checking is if there are any bad characters in the text file (can often happen on a Mac, in particular)---can you run:
file_tool -show_bad_all -infiles subslist.txt
... and see if that shows any bad characters, say? That could lead to a weird set error there, I guess.

Additionally, if you change
set sublist = (`cat subslist.txt`)
to
set sublist = ( 001 002 003 )
... and things work OK, then the issue might be a weird/bad character in that subslist.txt file.

Barring that, I would probably have to share a link with you to share the script and text file, and I could look at it in more detail.

--pt
Subject Author Posted

foreach loop errors

kyrieamara April 13, 2021 03:44PM

Re: foreach loop errors

ptaylor April 13, 2021 04:38PM

Re: foreach loop errors

kyrieamara April 13, 2021 05:15PM

Re: foreach loop errors

ptaylor April 14, 2021 09:05AM

Re: foreach loop errors

kyrieamara April 14, 2021 02:37PM

Re: foreach loop errors

kyrieamara April 14, 2021 05:23PM

Re: foreach loop errors

ptaylor April 14, 2021 05:39PM

Re: foreach loop errors

ptaylor April 14, 2021 05:37PM

Re: foreach loop errors

kyrieamara April 14, 2021 05:45PM

Re: foreach loop errors

Pawel April 14, 2021 11:54AM

Re: foreach loop errors

kyrieamara April 14, 2021 02:40PM