Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

alias for uname -n

Original Message
Name: magedbakr
Date: July 26, 2006 at 15:02:07 Pacific
Subject: alias for uname -n
OS: Solaris 9
CPU/Ram: Sparc Ultra III 2 GB RAM
Model/Manufacturer: Sun/Sparc Ultra III
Comment:
Dear All,

I'm trying to find any method to retrieve a logical host name instead of the real physical name when issue uname -a , for hostname command it can be done easily by alias hostname="echo logicalname" but for uname -a it's unappliacble

Thanks,
Maged


Report Offensive Message For Removal


Response Number 1
Name: lchi2000g
Date: July 26, 2006 at 16:18:25 Pacific
Subject: alias for uname -n
Reply: (edit)
1. /home/you/uname.sh file:

(`/bin/hostname` is the physical name and `hostname` is the logical name)

uname "$@" | sed "s/`/bin/hostname`/`hostname`/"

2. .profile file:

alias uname='/home/you/uname.sh'

Luke Chi


Report Offensive Follow Up For Removal

Response Number 2
Name: magedbakr
Date: July 27, 2006 at 04:21:53 Pacific
Subject: alias for uname -n
Reply: (edit)
Hi Luke,

Thank you for your help,
There are now 2 issues:
- The problem is in uname -n as we need to replace the node name , the uname without any options default to -s which mean return OS
example:
#uname
SunOS
Anyway I appended the -n option to the uname command in the entry you posted, it'll be

uname -n "$@" | sed "s/`/bin/hostname`/`hostname`/"

- The second issue is that when issuing the above command direct from the command line it worked successfully & returned the logical name

But when trying to call the file directly for test or just issue uname after set the profile file, it strangely return the physical name not the logical one.

My question now why the same command working correctly from the command line & working incorrectly when call the file

Thank You


Report Offensive Follow Up For Removal

Response Number 3
Name: magedbakr
Date: July 27, 2006 at 05:43:07 Pacific
Subject: alias for uname -n
Reply: (edit)
Hi Luke,

The real need is to alias the uname with the option -n ,
aliasing uname only not help ,coz even when it'll return the logical name (for example myserv)

$uname
myserv

$uname -n
myserv -n --> which will not match the s=logical name ........???

Thank You


Report Offensive Follow Up For Removal

Response Number 4
Name: lchi2000g
Date: July 27, 2006 at 07:00:00 Pacific
Subject: alias for uname -n
Reply: (edit)
please double-check:

/home/oracle/bin$ grep hostname $HOME/.profile
alias hostname='echo logicalname'
/home/oracle/bin$ grep uname $HOME/.profile
alias uname='/home/oracle/bin/uname.sh'

/home/oracle/bin$ type hostname
hostname is aliased to `echo logicalname'
/home/oracle/bin$ type uname
uname is aliased to `/home/oracle/bin/uname.sh'

/home/oracle/bin$ cat uname.sh
uname "$@" | sed "s/`hostname`/logicalname/"

/home/oracle/bin$ hostname
logicalname
/home/oracle/bin$ uname
Linux
/home/oracle/bin$ uname -s
Linux
/home/oracle/bin$ uname -n
logicalname
/home/oracle/bin$ uname -a
Linux logicalname 2.6.9-34.0.1.ELsmp #1 SMP Wed May 17 17:05:24 EDT 2006 i686 i686 i386 GNU/Linux

/home/oracle/bin$ ./uname.sh
Linux
/home/oracle/bin$ ./uname.sh -s
Linux
/home/oracle/bin$ ./uname.sh -n
logicalname
/home/oracle/bin$ ./uname.sh -a
Linux logicalname 2.6.9-34.0.1.ELsmp #1 SMP Wed May 17 17:05:24 EDT 2006 i686 i686 i386 GNU/Linux


Luke Chi


Report Offensive Follow Up For Removal

Response Number 5
Name: magedbakr
Date: July 27, 2006 at 09:47:09 Pacific
Subject: alias for uname -n
Reply: (edit)
Thank you a lot , it worked,
The difference was in the `hostname`;
When We wrote the logical hostname explicitly in uname.sh instead of using `hostname` it worked successfully

Thanks again



Report Offensive Follow Up For Removal


Response Number 6
Name: lchi2000g
Date: July 27, 2006 at 09:57:45 Pacific
Subject: alias for uname -n
Reply: (edit)
It's good to know that.

Luke Chi


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: alias for uname -n

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




acer 312T BIOS problem

K7 Turbo possible max fsb?

Pc anywher problem

WinFLP & OE/Outlook2003

Computer resets after a few minutes


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC