"Fossies" - the Fresh Open Source Software Archive 
Member "pfstools-2.2.0/src/matlab/pfs_shell.m" (12 Aug 2021, 1674 Bytes) of package /linux/privat/pfstools-2.2.0.tgz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Matlab source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 function cmd = pfs_shell( suffix )
2 % Returns command line that starts shell. Internal, do not use.
3
4 if ispc()
5 % -i option is needed to make sure that .bash_rc is executed and thus
6 % DISPLAY and other environment variables are set
7 if( exist( 'suffix', 'var' ) )
8 % This is put at the end of the shell command
9 cmd = '"';
10 else
11 [work_dir, cygwin_home] = pfs_fix_path( pwd() );
12
13 % This is put at the beginning of the shell command
14 cmd = sprintf('%s\\bin\\bash -l -c "cd ''%s'';', cygwin_home, work_dir);
15 end
16 else
17 if( ~exist( 'suffix', 'var' ) )
18 work_dir = strrep(pwd(),'\','/');
19
20 % It is necessary to set all ENV variables before invoking
21 % pfstools commands. '/bin/bash' may need to be replaced with the
22 % shell you are using.
23
24 % This will remove all references to matlab libraries from the
25 % LD_LIBRARY_PATH. pfstools usually do not work with matlab version
26 % of the standard libraries
27 set_ld_path='export LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed "y/:/\n/" | grep --ignore-case -v "matlab" | sed ":beg;N;s/\n/:/;t beg;"`';
28
29 if( strcmp( computer, 'MACI64' ) || strcmp( computer, 'MACI32' ) )
30 set_ld_path=cat( 2, set_ld_path, '; export DYLD_FRAMEWORK_PATH=`echo $DYLD_FRAMEWORK_PATH | sed "y/:/\n/" | grep --ignore-case -v "matlab" | sed ":beg;N;s/\n/:/;t beg;"`' );
31 end
32
33 % Start shell, cd to the working directory and remove matlab
34 % libraries
35 cmd = sprintf('/bin/bash -l -c ''cd "%s"; %s;', work_dir, set_ld_path );
36 else
37 cmd='''';
38 end
39 end
40
41 end