Print

Print


Dear Dr Mark,

This is what I have typed in the script:

#!/bin/sh

bet vol vol_brain
/Users/neuro/Desktop/fsl/Data\ Files\
FDT/fsl_course_data/scripting/im1.nii.gz
chmod +x bet_vol
./bet_vol

















-uu-:---F1  bet_vol        All L1
(Shell-script[sh])------------------------
Indentation setup for shell type sh


And this is what is in the shell terminal:

Last login: Thu Aug  7 13:31:47 on ttys000
[neuros-iMac-2:~] neuro% ls
#bet# Dropbox Public bet_vol~ logs
Applications Library Wine Files build.log ls
Desktop Movies bedpostx fsl.csh ls.out
Documents Music bet fsl.sh matlab
Downloads Pictures bet_vol jobs }
[neuros-iMac-2:~] neuro% ls-la
ls-la: Command not found.
[neuros-iMac-2:~] neuro% ls -la
total 1120
-rw-r--r--    1 neuro  staff       0 Sep  3  2013 #bet#
drwxrw-r--+  56 neuro  staff    1904 Aug  7 10:40 .
drwxr-xr-x    5 root   admin     170 Mar  5  2013 ..
-rw-r--r--    1 neuro  staff  485133 Nov 27  2013 ..nii.gz
-rw-------    1 neuro  staff       3 Mar  5  2013 .CFUserTextEncoding
-rw-r--r--@   1 neuro  staff    6148 Jul 24 18:46 .DS_Store
drwx------    2 neuro  staff      68 Aug  7 13:43 .Trash
-rw-------    1 neuro  staff     273 Aug  4 15:50 .Xauthority
drwxr-xr-x    4 neuro  staff     136 Mar  5  2013 .adobe
drwxr-xr-x    3 neuro  staff     102 Jul 16  2013 .assistant
-rw-------    1 root   staff     169 May 29  2013 .bash_history
-rw-------@   1 neuro  staff     123 Jul  8 12:11 .bash_profile
-rw-r--r--@   1 neuro  staff     123 Jul  8 12:28 .bash_profile copy.txt
drwxr-xr-x    3 neuro  staff     102 Jul  4  2013 .cache
drwxr-xr-x    3 neuro  staff     102 May 29 11:07 .config
-rw-r--r--    1 neuro  staff     132 Nov 27  2013 .cshrc
drwx------    3 neuro  staff     102 Mar 20  2013 .cups
drwxr-xr-x    3 neuro  staff     102 Oct  3  2013 .dcm2nii
drwxr-xr-x    3 neuro  staff     102 Oct  3  2013 .dcm2niigui
drwx------   10 neuro  staff     340 Aug  7 11:39 .dropbox
drwxr-xr-x    4 neuro  staff     136 Jul  7 13:47 .emacs.d
drwxr-xr-x    2 neuro  staff      68 May 28  2013 .fslconf
-rw-------    1 neuro  staff       0 Jul 10 13:47 .lesshst
drwxr-xr-x    3 neuro  staff     102 May 29 11:07 .local
-rw-r--r--    1 neuro  staff     188 Nov 27  2013 .mat
drwxr-xr-x    5 neuro  staff     170 Oct  3  2013 .mricron
-rw-------    1 neuro  staff   12288 Mar 21 13:42 .myscript.swp
drwxr-xr-x    3 neuro  staff     102 Oct  3  2013 .npm
-rw-------    1 neuro  staff    1024 Aug  4 10:28 .rnd
-rw-------    1 neuro  staff     128 Mar 21 13:09 .serverauth.415
-rw-------    1 neuro  staff    2416 Jul 25 18:37 .sh_history
-rw-------    1 neuro  staff    4024 Mar 21 13:45 .viminfo
drwxr-xr-x    2 neuro  staff      68 Mar  5  2013 Applications
drwx------+  15 neuro  staff     510 Aug  7 13:43 Desktop
drwx------+  23 neuro  staff     782 Jul 24 19:21 Documents
drwx------+ 206 neuro  staff    7004 Aug  7 12:39 Downloads
drwx------@  13 neuro  staff     442 Aug  7 11:39 Dropbox
drwx------@  50 neuro  staff    1700 Jun  3 11:15 Library
drwx------+   3 neuro  staff     102 Mar  5  2013 Movies
drwx------+   5 neuro  staff     170 Apr 23  2013 Music
drwx------+  14 neuro  staff     476 Dec 17  2013 Pictures
drwxr-xr-x+   4 neuro  staff     136 Mar  5  2013 Public
drwxr-xr-x    9 neuro  staff     306 May 29 11:07 Wine Files
drwxr-xr-x    4 neuro  staff     136 Mar 11 10:46 bedpostx
-rw-r--r--    1 neuro  staff       0 Sep  3  2013 bet
-rw-r--r--    1 neuro  staff     130 Aug  4 15:33 bet_vol
-rw-r--r--    1 neuro  staff      28 Aug  4 15:32 bet_vol~
-rw-r--r--    1 neuro  staff      84 Jul 16  2013 build.log
-rw-r--r--    1 neuro  staff      33 May 28  2013 fsl.csh
-rw-r--r--    1 neuro  staff      48 May 28  2013 fsl.sh
drwxr-xr-x    2 neuro  staff      68 Jul 31  2013 jobs
drwxr-xr-x    2 neuro  staff      68 Jul 31  2013 logs
drwxr-xr-x    2 neuro  staff      68 Jul 22  2013 ls
-rw-r--r--    1 neuro  staff     166 Jul 10 17:43 ls.out
drwxr-xr-x    4 neuro  staff     136 Sep 26  2013 matlab
drwxr-xr-x    2 neuro  staff      68 Apr 23  2013 }
[neuros-iMac-2:~] neuro% cd Desktop
[neuros-iMac-2:~/Desktop] neuro% ls
Alfred_2.3_264.zip UMMC Division of Neurosurgery
Isobel's_Master's_Project \.mkv
Niftii_Files fsl
Normal.dotm osx-2
OsiriX_Data startfsl.sh
SPM startfsl.txt
[neuros-iMac-2:~/Desktop] neuro% cd fsl
[neuros-iMac-2:~/Desktop/fsl] neuro% ls
Data Files FDT build extras
FSL instructions.docx build.log include
LICENCE config lib
README data refdoc
autoPtx_0_1_1 doc src
bin etc tcl
[neuros-iMac-2:~/Desktop/fsl] neuro% cd "Data Files FDT"
[neuros-iMac-2:~/Desktop/fsl/Data Files FDT] neuro% ls
fsl_course_data fsl_course_data 5 fsl_course_data4.tar.gz
fsl_course_data 2 fsl_course_data1.tar.gz fsl_course_data5.tar.gz
fsl_course_data 3 fsl_course_data2.tar.gz
fsl_course_data 4 fsl_course_data3.tar.gz
[neuros-iMac-2:~/Desktop/fsl/Data Files FDT] neuro% cd fsl_course_data
[neuros-iMac-2:fsl/Data Files FDT/fsl_course_data] neuro% ls
intro reg scripting seg_struc
[neuros-iMac-2:fsl/Data Files FDT/fsl_course_data] neuro% cd scripting
[neuros-iMac-2:Data Files FDT/fsl_course_data/scripting] neuro% ls
bet-vol im3.nii.gz vol0002.nii.gz
bet_vol im4.nii.gz vol0003.nii.gz
bet_vol~ im5.nii.gz vol0004.nii.gz
design.fsf settings.txt vol0005.nii.gz
example_func.nii.gz stim1.txt vol0006.nii.gz
highres.nii.gz visualmask.nii.gz vol0007.nii.gz
hr_zstat1.nii.gz vol vol0008.nii.gz
im1.nii.gz vol0000.nii.gz vol0009.nii.gz
im2.nii.gz vol0001.nii.gz zstat2.nii.gz
[neuros-iMac-2:Data Files FDT/fsl_course_data/scripting] neuro% emacs
bet_vol
[neuros-iMac-2:Data Files FDT/fsl_course_data/scripting] neuro% ./bet_vol
./bet_vol: Permission denied.
[neuros-iMac-2:Data Files FDT/fsl_course_data/scripting] neuro% emacs
bet_vol
[neuros-iMac-2:Data Files FDT/fsl_course_data/scripting] neuro%

Can you tell me what I am doing wrong? Tqvm!


*Best regards,*

*Isobel French*
*Academic Coordinator and Research Officer*
*Division of Neurosurgery*
*Department of Surgery*
*Faculty of Medicine*
*University of Malaya*
*016-7937605*
*03-79493138*


On Tue, Aug 5, 2014 at 4:03 PM, Mark Jenkinson <[log in to unmask]
> wrote:

>  Hi,
>
>  In general we would strongly recommend against the use of sudo for new
> users, especially when learning how to use unix/linux.  This is because
> there is a much greater danger of removing/corrupting important files when
> things are run as sudo.  So please do not use sudo in general (there might
> be occasions when you install new software when it is necessary, but it
> should be clearly indicated in that case, and you should not need it for
> your own scripts and analyses).
>
>  In order to get to the bottom of this problem we need to see the result
> of running "ls -la" in the directory that your script is in, and when also
> need to know exactly what command you are typing into the terminal.  It
> would also be helpful to see the contents of the script file.
>
>  All the best,
> Mark
>
>
>
>
>  On 4 Aug 2014, at 08:36, Isobel French <[log in to unmask]>
>  wrote:
>
>  H Erdem,
>
>  I have tried what you said but still the same response: 'Permission
> denied'. What could be the problem here?
>
>
>  *Best regards,*
>
>  *Isobel French*
> *Academic Coordinator and Research Officer*
> *Division of Neurosurgery*
> *Department of Surgery*
> *Faculty of Medicine*
> *University of Malaya*
> *016-7937605*
> *03-79493138*
>
>
> On Mon, Aug 4, 2014 at 2:35 PM, Erdem Ergen <[log in to unmask]> wrote:
>
>> Do you execute script with "sudo" ? Maybe you should type it as "sudo chmod
>> +x bet_vol" "sudo ./bet_vol" then system can request root password,
>> after you type it, system should execute script.
>>
>>
>>
>>
>>
>> 2014-08-04 7:29 GMT+03:00 Isobel French <[log in to unmask]>:
>>
>>  Dear Dr Stephen and Erdem,
>>>
>>>  I have done both of what you have suggested. However, i still get the
>>> same response which is 'Permission denied". I really do not know what it is
>>> that I am doing wrong. Please advise. Thanks.
>>>
>>>
>>>  *Best regards,*
>>>
>>>  *Isobel French*
>>> *Academic Coordinator and Research Officer*
>>> *Division of Neurosurgery*
>>> *Department of Surgery*
>>> *Faculty of Medicine*
>>> *University of Malaya*
>>> *016-7937605*
>>> *03-79493138*
>>>
>>>
>>>  On Fri, Jul 25, 2014 at 7:12 PM, Erdem Ergen <[log in to unmask]>
>>> wrote:
>>>
>>>> Actually this subject is not related with MRI subject exactly. You can
>>>> find lots of information about operating system commands in linux/unix
>>>> forums such as "
>>>> http://stackoverflow.com/questions/18960689/ubuntu-says-bash-program-permission-denied
>>>> ".
>>>>
>>>> Just give permission to the "./bet_vol" script/program as typing "chmod
>>>> +x bet_vol".
>>>>
>>>
>>>
>>
>>
>>  --
>> Erdem Ergen
>> Bilg. Müh.
>>
>
>
>