Home > vbmeg > functions > tool_box > dmri_processor > functions > dmri_script_file_create.m

dmri_script_file_create

PURPOSE ^

Create template script file which contains path setting.

SYNOPSIS ^

function [isok] = dmri_script_file_create(filename)

DESCRIPTION ^

 Create template script file which contains path setting.

 [Usage]
    [isok] = dmri_script_file_create(filename);

 [Input]
    filename : template script(bash) filename.

 [Output]
    isok : = true  : script creation success.
           = false : script creation failure.

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [isok] = dmri_script_file_create(filename)
0002 % Create template script file which contains path setting.
0003 %
0004 % [Usage]
0005 %    [isok] = dmri_script_file_create(filename);
0006 %
0007 % [Input]
0008 %    filename : template script(bash) filename.
0009 %
0010 % [Output]
0011 %    isok : = true  : script creation success.
0012 %           = false : script creation failure.
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 %
0018 % --- Previous check
0019 %
0020 dmri_setenv;
0021 if isempty(getenv('BASH_PROF'))
0022     error('dmri settings not found. please execute dmri_setenv.m');
0023 end
0024 
0025 %
0026 % --- Main Procedure
0027 %
0028 isok = true;
0029 fid = fopen(filename, 'wt');
0030 if fid == -1
0031     isok = false;
0032     return;
0033 end
0034 
0035 % Create bash script and write tool path settings.
0036 fprintf(fid, ['#!', getenv('BASH_PATH') '\n']);
0037 fprintf(fid, ['source ' getenv('BASH_PROF') '\n\n']);
0038 fclose(fid);
0039 system(['chmod 755 ' filename]);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005