Changeset 20443
- Timestamp:
- 04/06/16 19:54:32 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/os/oshostname.m
r20442 r20443 5 5 % hostname=oshostname(); 6 6 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 12 if status~=0, 13 if ispc 14 hostname = getenv('COMPUTERNAME'); 15 else 16 hostname = getenv('HOSTNAME'); 17 end 12 18 end 13 19 … … 15 21 hostname = strrep(hostname,'-',''); 16 22 23 % Trim and lower case 24 hostname = strtrim(lower(hostname)); 25 17 26 % Check that machine name is not empty 18 27 if isempty(hostname),
Note:
See TracChangeset
for help on using the changeset viewer.