Changeset 20443


Ignore:
Timestamp:
04/06/16 19:54:32 (9 years ago)
Author:
Mathieu Morlighem
Message:

BUG: previous method did not seem to work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/os/oshostname.m

    r20442 r20443  
    55%      hostname=oshostname();
    66
    7 % Find computer name from environment
    8 if ispc
    9         hostname = getenv('COMPUTERNAME');
    10 else
    11         hostname = getenv('HOSTNAME');
     7%See http://www.mathworks.com/help/matlab/ref/system.html "tips" section
     8%We need to add < /dev/null otherwise what is in the clipboard is added
     9[status,hostname]=system('hostname < /dev/null');
     10
     11% If that command did not work, we have an alternative
     12if status~=0,
     13        if ispc
     14                hostname = getenv('COMPUTERNAME');
     15        else
     16                hostname = getenv('HOSTNAME');
     17        end
    1218end
    1319
     
    1521hostname = strrep(hostname,'-','');
    1622
     23% Trim and lower case
     24hostname = strtrim(lower(hostname));
     25
    1726% Check that machine name is not empty
    1827if isempty(hostname),
Note: See TracChangeset for help on using the changeset viewer.