source: issm/branches/trunk-jpl-damage/src/m/utils/OS/oshostname.m@ 11427

Last change on this file since 11427 was 10749, checked in by Eric.Larour, 13 years ago

Better oshostname resolutoin

File size: 534 bytes
Line 
1function hostname=oshostname()
2%OSHOSTNAME figure out hostname, irrespective of os type
3%
4% usage: hostname=oshostname();
5%
6%
7
8if ispc,
9 [status,hostname]=system('hostname');hostname=hostname(1:end-1);
10
11 if status,
12 error('oshostname error message: could not run hostname command on windows os');
13 end
14
15else
16 [status,hostname]=system(['hostname -s | sed ''s/-//g''']);
17 if status,
18 error('oshostname error message: could not run hostname command on *nix os');
19 end
20 hostname=hostname(1:end-1);
21 hostname=ddewhite(hostname);
22end
Note: See TracBrowser for help on using the repository browser.