Hi,
Actually, all I think you need to do is get the script into TextEdit
then go to Format -> Make Plain Text (via the menus) and
save after that. Keep the .sh extension and all should be well.
The ^M characters are almost certainly problems caused by
converting between machines (Windows or linux to Mac) so
I'd avoid doing that.
All the best,
Mark
On 2 Aug 2011, at 16:27, wolf zinke wrote:
> Do you receive the same error message now, or is it a different one? Maybe the colleague who provided this script could be of assistance here, because this issue seems to be related to the script in a rather general sense. And I rather doubt that you want to post it here so that others might look into it.
>
> So, anyway, good luck,
> wolf
>
>
> Leslie Engineering wrote:
>> no, it doesn't work despite that it is saved as .sh
>>
>> (ok meant, ok I will look at the apple site for help.. but so far no luck!)
>>
>>
>>
>> On Tue, Aug 2, 2011 at 11:00 AM, wolf zinke <[log in to unmask]> wrote:
>> OK means you solved it?
>>
>> Saving it as plain text does not mean to save it with the .txt extension, sorry about not being clear about it. It means just making sure that there are no formatting calls from a word processor. I would still recommend to use the .sh extension or no extension to indicate that it is an executable bash file.
>>
>> But if it is working now, that's fine.
>>
>> wolf
>>
>>
>> Leslie Engineering wrote:
>>> ok
>>>
>>>
>>> On Tue, Aug 2, 2011 at 10:41 AM, Leslie Engineering <[log in to unmask]> wrote:
>>> Ok, it seems this computer saves things as rich text, so I sent a file from my older computer in plain text format and cut and paste the script. Now I get the following:
>>>
>>> bash-3.2$ chmod +x script.txt
>>> bash-3.2$ ./script.txt
>>> bash: ./sta1.txt: /bin/bash^M: bad interpreter: No such file or directory
>>>
>>>
>>> On Tue, Aug 2, 2011 at 10:31 AM, Leslie Engineering <[log in to unmask]> wrote:
>>> I am not sure what you mean by plain "ascii" text editor. I opened it in TextEdit on my Mac OSX 10.6.6 and can't seem to find any other plain text applications. Do I need to download something?
>>>
>>>
>>> On Tue, Aug 2, 2011 at 10:24 AM, wolf zinke <[log in to unmask]> wrote:
>>> looks like this script was edited with a word processor and contains formating that are causing problems as ascii text file. Open this file again with a word processor, copy it into a plain ascii text editor and save t again (as plain text). Do not edit programs with a Word processor.
>>>
>>>
>>> hope this helps,
>>> wolf
>>>
>>>
>>> Leslie Engineering wrote:
>>> Sorry :)
>>>
>>> So this is what I get :
>>>
>>>
>>> bash-3.2$ chmod +x script_name.sh bash-3.2$ ./script_name.sh ./sta.sh: line 1: {rtf1ansiansicpg1252cocoartf1038cocoasubrtf350: command not found
>>> ./sta.sh: line 2: syntax error near unexpected token `}'
>>> ./sta.sh: line 2: `{\fonttbl\f0\fswiss\fcharset0 Helvetica;}'
>>>
>>>
>>>
>>> I don't know how to interpret!
>>>
>>> On Tue, Aug 2, 2011 at 10:10 AM, Cunningham, Dustin <[log in to unmask] <mailto:[log in to unmask]>> wrote:
>>>
>>> It looks like your file is a bash shell script. I think you can
>>> just give it executive privileges and run it in the terminal.
>>>
>>> try this:
>>>
>>> chmod +x filename
>>> ./filename
>>> ________________________________________
>>> From: FSL - FMRIB's Software Library [[log in to unmask]
>>> <mailto:[log in to unmask]>] On Behalf Of Leslie Engineering
>>> [[log in to unmask] <mailto:[log in to unmask]>]
>>>
>>> Sent: Tuesday, August 02, 2011 9:27 AM
>>> To: [log in to unmask] <mailto:[log in to unmask]>
>>>
>>> Subject: [FSL] running a script with FSL
>>>
>>> A colleague sent a single trial analysis script that he says "runs
>>> with FSL 4.0 and above"
>>>
>>> How do you run a script with fsl?
>>>
>>> I set the path in xterm:
>>>
>>> export PATH="$PATH:~/scripts_folder"
>>>
>>> and tried to source the file
>>>
>>> source script_name.sh
>>>
>>> (clearly computers are not like the back of my hand...)
>>>
>>> Is there something in the fsl gui where I can automatically select
>>> the script.. because I am unable to do it in the terminal prompt.
>>>
>>>
>>>
>>>
>>>
>>
>>
>
|