- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- eval command help...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2011 07:26 AM
09-11-2011 07:26 AM
eval command help...
/opt/OV/bin/OpC/install/opc_ip_addr -help
Usage: opc_ip_addr [hostname] .. [hostname]
opc_ip_addr [ip] .. [ip]
opc_ip_addr -r [hexip] .. [hexip]
Convert an hostnames or an ip-adresses to a hex-ip-strings w/o dots
i want to convert a hexip to node name.
that is
opc_ip_addr -r hexip
when i run straight forward:
sekar@OVO> /opt/OV/bin/OpC/install/opc_ip_addr -r <hexip>
node.name.com = 1.1.2.3 = <hexip>
but thru a script, i will have the hexip thru a variable.
inside the script, when i run
/opt/OV/bin/OpC/install/opc_ip_addr -r $HEXIP_VARIABLE
its not using the value of HEXIP_VARIABLE. it says "no hex_ip or wrong format"
any clues?? you need more infromation??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2011 07:34 AM
09-11-2011 07:34 AM
Re: eval command help...
any idea how to remove the "enter key" ???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2011 07:43 AM
09-11-2011 07:43 AM
Re: eval command help...
now
hexvalue=cut -c26-32 $ID
this returns "-c26-32 not found
hexvalue=`cut -c26-32 $ID`
this returns
cut: Cannot open f375e6da-b5e7-71a0-0235-031f8e1e0000.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2011 07:50 AM - edited 09-11-2011 07:52 AM
09-11-2011 07:50 AM - edited 09-11-2011 07:52 AM
Re: eval command help...
>any idea how to remove the CR?
You fix your data file so it doesn't end in CR/LF with dos2ux(1).
Or you would remove the last char of the variable:
HEX_VARIABLE=${HEX_VARIABLE%.}
Or use echo and tr(1) to delete it.
Or use echo and cut(1) to remove it:
hexvalue=$(echo $ID | cut -c26-32)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2011 07:56 AM
09-11-2011 07:56 AM
Re: eval command help...
Hi:
@sekar sundaram wrote:
i got it....the $HEX_VARIABLE has a carriage return(enter key)...
any idea how to remove the "enter key" ???
You could do:
HEX_VARIABLE=$(echo ${HEX_VARIABLE}|perl -pe 's/\r//g')
or even faster:
HEX_VARIABLE=$(echo ${HEX_VARIABLE}|tr -d "\015")
Regards!
...JRF...
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2011 08:01 AM
09-11-2011 08:01 AM
Re: eval command help...
Cool....its good...
HEX_IP=$(echo $ID | cut -c26-32)
one more issue....
when i run
opc_ip_addr -r $HEX_IP
it runs good...
but when i assign the value to NODE like this,
NODE=opc_ip_addr -r $HEX_IP
it gives:
./script.sh: -r: not found
any ideas???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2011 08:04 AM - edited 09-11-2011 08:07 AM
09-11-2011 08:04 AM - edited 09-11-2011 08:07 AM
Re: eval command help...
>but when I assign the value to NODE like this: NODE=opc_ip_addr -r $HEX_IP
The correct form for command substitution is:
NODE=$(opc_ip_addr -r $HEX_IP)
>./script.sh: -r: not found
Your syntax did something like: (export NODE=opc_ip_addr; -r $HEX_IP)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2011 08:06 AM
09-11-2011 08:06 AM
Re: eval command help...
@sekar sundaram wrote:Cool....its good...
HEX_IP=$(echo $ID | cut -c26-32)
one more issue....
when i run
opc_ip_addr -r $HEX_IP
it runs good...
but when i assign the value to NODE like this,
NODE=opc_ip_addr -r $HEX_IP
it gives:
./script.sh: -r: not found
any ideas???
Hi:
Of course. Do:
NODE=$(opc_ip_addr -r $HEX_IP)
By the way, using 'cut' with columns means that this only works if your input string has exactly the format you want. I'd use the 'tr' I suggested above.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2011 08:08 AM
09-11-2011 08:08 AM
Re: eval command help...
between,
NODE=opc_ip_addr -r $HEX_IP
for this situation, cant we use eval command?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2011 08:11 AM
09-11-2011 08:11 AM
Re: eval command help...
@sekar sundaram wrote:
super cool....i got it 100%...
between,
NODE=opc_ip_addr -r $HEX_IP
for this situation, cant we use eval command?
Why? The $(...) for is the modern replacement for the archaic backtick syntax. This runs the command and assigns the output (if any) to the lvalue (variable).
An 'eval' is used in situations where you need the shell to scan input twice; once to interpolate variables and the second time to use them.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2011 08:13 AM
09-11-2011 08:13 AM
Re: eval command help...
>for this situation, can't we use eval command?
Why? If you want to do command substitution, $() (or the archaic ``), do command substitution, not eval.