Home > src > matlab > pfs_shell.m

pfs_shell

PURPOSE ^

Returns command line that starts shell. Internal, do not use.

SYNOPSIS ^

function cmd = pfs_shell( suffix )

DESCRIPTION ^

 Returns command line that starts shell. Internal, do not use.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function cmd = pfs_shell( suffix )
0002 % Returns command line that starts shell. Internal, do not use.
0003 
0004 if ispc()
0005     % -i option is needed to make sure that .bash_rc is executed and thus
0006     % DISPLAY and other environment variables are set
0007     if( exist( 'suffix', 'var' ) )
0008         % This is put at the end of the shell command
0009         cmd = '''';
0010     else
0011         work_dir = strrep(pwd(),'\','/');
0012         
0013         %    work_dir = regexprep(work_dir, ...
0014         %        '([a-z]):','/cygdrive/$1', 'ignorecase','once');
0015         
0016         [pstatus pdir] = dos('set CYGWIN_HOME');
0017         if(pstatus == 1)
0018             pdir = 'c:\\cygwin'; 
0019         else
0020             [pstatus pdir] = dos('echo %CYGWIN_HOME%');
0021             pdir = strcat(pdir, ''); % used to remove final LF
0022         end
0023            
0024         % This is put at the beginning of the shell command
0025         cmd = sprintf('%s\\bin\\bash -i -l -c ''cd "%s";', pdir, work_dir);
0026     end
0027 else
0028     if( ~exist( 'suffix', 'var' ) )
0029         work_dir = strrep(pwd(),'\','/');
0030 
0031         % This is necessary to set all ENV variables before invoking
0032         % pfstools commands. '/bin/bash' may need to be replaced with the
0033         % shell you are using.
0034         
0035         % This is put at the beginning of the shell command
0036         cmd = sprintf('/bin/bash -l -c ''cd "%s";', work_dir);
0037     else
0038         cmd='''';
0039     end
0040 end
0041 
0042 end

Generated on Tue 03-Mar-2009 13:03:09 by m2html © 2003