함수 hostname()

gethostname
hostname
uname

1 Bash[ | ]

hostname
echo $HOSTNAME
uname -n

2 Cmd[ | ]

hostname
for /f "tokens=1" %a in ('hostname') do set myhostname=%a
echo %myhostname%

3 PHP[ | ]

echo gethostname();
echo php_uname('n');
echo getenv('HOSTNAME');
echo exec('hostname');
echo exec('echo $HOSTNAME');
echo exec('uname -n');

4 PowerShell[ | ]

[System.Net.Dns]::GetHostName()

5 Python[ | ]

import socket
print(socket.gethostname())
import subprocess
s = subprocess.Popen('hostname', shell=True, stdout=subprocess.PIPE).stdout.read().strip()
print( s )

6 Perl[ | ]

use Sys::Hostname;
my $host = hostname();
print $host . "\n";
print `hostname`;

7 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}