Hi,
Try the following:
cp script.txt badscript.txt
cat badscript.txt | tr \\r \\n > script.txt
but be careful to get this exactly right.
This should do the same job as dos2unix (which doesn't exist on the mac).
However, I suspect you also have an error in that the script is somehow
looking for a file called sta1.txt which it can't find. So this may not be the
end of your problems, but hopefully it will get rid of the one complaining
about ^M characters.
If you do get the sta1.txt error then try to find this file and put it in the
current working directory. Or, if it is already there, this file might also contain
characters, so try and save it as plain text and run the above commands
to get rid of the ^M characters if that is the case (but change the file names
appropriately).
All the best,
Mark
On 2 Aug 2011, at 18:02, Leslie Engineering wrote:
> So I used the same .sh script but made sure it was in plain text format (as per the format tab in textedit) and I reran find ing the same error (i.e. bash: ./sta1.txt: /bin/bash^M: bad interpreter: No such file or directory) so I tried the 'dos2unix' command, but it wasn't recognized.
>
> I am on a mac osx 10.6.6, by the way.
>
> I appreciate all the help! This forum is amazing!
>
>
> On Tue, Aug 2, 2011 at 12:16 PM, Xiangzhen Kong <[log in to unmask]> wrote:
> Maybe the command 'dos2unix' help avoiding the error 'bad interpreter: No such file or directory'.
> bash-3.2$ chmod +x script.txt
> bash-3.2$ dos2unix ./script.txt
> bash-3.2$ ./script.txt
>
> Best!
>
> 2011-08-03
> Xiangzhen Kong
> 发件人: Leslie Engineering
> 发送时间: 2011-08-02 22:41:33
> 收件人: FSL
> 抄送:
> 主题: Re: [FSL] running a script with FSL
> 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.
>
>
>
>
>
|