with bash : hostname -d - with perl?

E

ecureuil

hi,

With bash : hostname -d

I don't find the command with Perl for that...

;o(

Thank you
anne
 
S

Sherm Pendley

ecureuil said:
With bash : hostname -d

I don't find the command with Perl for that...

"That" being what, exactly? Running the "hostname" tool, or writing the
equivalent of "hostname" in pure Perl?

sherm--
 
E

ecureuil

"Sherm Pendley" <[email protected]> a écrit dans le message de (e-mail address removed)...
|
| > With bash : hostname -d
| >
| > I don't find the command with Perl for that...
|
| "That" being what, exactly? Running the "hostname" tool, or writing the
| equivalent of "hostname" in pure Perl?
|

writing the equivalent of "hostname" in pure Perl ! :eek:)

anne
 
E

ecureuil

"ecureuil" <[email protected]> a écrit dans le message de [email protected]...
|
| "Sherm Pendley" <[email protected]> a écrit dans le message de | (e-mail address removed)...
||
|| > With bash : hostname -d
|| >
|| > I don't find the command with Perl for that...
||
|| "That" being what, exactly? Running the "hostname" tool, or writing the
|| equivalent of "hostname" in pure Perl?
||
|
| writing the equivalent of "hostname" in pure Perl ! :eek:)
|
I need the domainname

anne
 
A

A. Sinan Unur

"Sherm Pendley" <[email protected]> a écrit dans le message de (e-mail address removed)...
|
| > With bash : hostname -d
| >
| > I don't find the command with Perl for that...
|
| "That" being what, exactly? Running the "hostname" tool, or writing
| the equivalent of "hostname" in pure Perl?
|

writing the equivalent of "hostname" in pure Perl ! :eek:)


D:\Home> perl -MSys::Hostname -e "print hostname"
Aardvark

Does this count as a SAQ?

Sinan

--
A. Sinan Unur <[email protected]>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
 
E

ecureuil

"A. Sinan Unur" <[email protected]> a écrit dans le message de [email protected]...
| |
| >
| > "Sherm Pendley" <[email protected]> a écrit dans le message de | > (e-mail address removed)...
| >|
| >| > With bash : hostname -d
| >| >
| >| > I don't find the command with Perl for that...
| >|
| >| "That" being what, exactly? Running the "hostname" tool, or writing
| >| the equivalent of "hostname" in pure Perl?
| >|
| >
| > writing the equivalent of "hostname" in pure Perl ! :eek:)
|
|
| D:\Home> perl -MSys::Hostname -e "print hostname"
| Aardvark
|
| Does this count as a SAQ?
|

my domain = domain.com
my server name = serv1

I work with linux

perl -MSys::Hostname -e "print hostname" => 'serv1'

$ENV{'HOST'} => 'serv1.domain.com' => not good

I would like 'domain.com' !

anne
 
A

A. Sinan Unur

"A. Sinan Unur" <[email protected]> a écrit dans le message de
[email protected]...
| |
| >
| > "Sherm Pendley" <[email protected]> a écrit dans le message de
| > news: (e-mail address removed)...
| >|
| >| > With bash : hostname -d
| >| >
| >| > I don't find the command with Perl for that...
| >|
| >| "That" being what, exactly? Running the "hostname" tool, or
| >| writing the equivalent of "hostname" in pure Perl?
| >|
| >
| > writing the equivalent of "hostname" in pure Perl ! :eek:)
|
|
| D:\Home> perl -MSys::Hostname -e "print hostname"
| Aardvark
|
| Does this count as a SAQ?
|

my domain = domain.com
my server name = serv1

I work with linux

perl -MSys::Hostname -e "print hostname" => 'serv1'

If this is intended to show what you got when you ran the code, I would
recommend that you copy and paste from the shell where you ran the code
instead of re-typing. The notation above is confusing, especially since
the character '>' has a meaning in most shells.
$ENV{'HOST'} => 'serv1.domain.com' => not good

I would like 'domain.com' !

What's up with the exclamation point? Do you realize you are in no
position to order people around?

You should learn to search CPAN for relevant keywords.

D:\Home> perl -MNet::Domain -e "print Net::Domain::hostdomain"
twcny.rr.com

Sinan

--
--
A. Sinan Unur <[email protected]>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
 
E

ecureuil

"A. Sinan Unur" <[email protected]> a écrit dans le message de [email protected]...
| |
| >
| > "A. Sinan Unur" <[email protected]> a écrit dans le message de
| > [email protected]...
| >| | >|
| >| >
| >| > "Sherm Pendley" <[email protected]> a écrit dans le message de
| >| > news: (e-mail address removed)...
| >| >|
| >| >| > With bash : hostname -d
| >| >| >
| >| >| > I don't find the command with Perl for that...
| >| >|
| >| >| "That" being what, exactly? Running the "hostname" tool, or
| >| >| writing the equivalent of "hostname" in pure Perl?
| >| >|
| >| >
| >| > writing the equivalent of "hostname" in pure Perl ! :eek:)
| >|
| >|
| >| D:\Home> perl -MSys::Hostname -e "print hostname"
| >| Aardvark
| >|
| >| Does this count as a SAQ?
| >|
| >
| > my domain = domain.com
| > my server name = serv1
| >
| > I work with linux
| >
| > perl -MSys::Hostname -e "print hostname" => 'serv1'
|
| If this is intended to show what you got when you ran the code, I would
| recommend that you copy and paste from the shell where you ran the code
| instead of re-typing. The notation above is confusing, especially since
| the character '>' has a meaning in most shells.
|
| > $ENV{'HOST'} => 'serv1.domain.com' => not good
| >
| > I would like 'domain.com' !
|
| What's up with the exclamation point? Do you realize you are in no
| position to order people around?

It was not my thought

|
| You should learn to search CPAN for relevant keywords.

I sought on CPAN but not with the good word

|
| D:\Home> perl -MNet::Domain -e "print Net::Domain::hostdomain"
| twcny.rr.com
|

thank you!
I am very happy!

anne
 
A

A. Sinan Unur

"A. Sinan Unur" <[email protected]> a écrit dans le message de
....

| You should learn to search CPAN for relevant keywords.

I sought on CPAN but not with the good word


http://search.cpan.org/search?query=hostname

http://search.cpan.org/search?query=domain

What else would you search for?

Sinan

--
A. Sinan Unur <[email protected]>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
 
E

ecureuil

"A. Sinan Unur" <[email protected]> a écrit dans le message de [email protected]...
| |
| >
| > "A. Sinan Unur" <[email protected]> a écrit dans le message de
|
| ...
|
| >| You should learn to search CPAN for relevant keywords.
| >
| > I sought on CPAN but not with the good word
|
|
| http://search.cpan.org/search?query=hostname
|
| http://search.cpan.org/search?query=domain
|
| What else would you search for?
|

I did not think of the word ' domain'

In bash :

man hostname
....
OPTIONS
-a, --alias
Display the alias name of the host (if used).

-d, --domain
Display the name of the DNS domain. Don't use the command
domainname to get the DNS domain name because it will show the NIS domain
name and not the DNS domain name. Use dnsdomainname instead.

-i, --ip-address
Display the IP address(es) of the host.

anne
 
D

Dr.Ruud

ecureuil schreef:
the equivalent of "hostname" in pure Perl ! :eek:)

Or you could do:

perl -e 'print `hostname -d`' ;

but that isn't portable, at least because some OS's (like Windows and
FreeBSD) hostname-executables don't know the "-d".


After $domain = `hostname -d` there is a newline at the end of $domain,
so do a chomp before using it:

chomp ($domain = `hostname -d`) ;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top