- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Why `expr $VAR : '.*'` return the length of VAR?
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
03-14-2006 09:47 PM
03-14-2006 09:47 PM
I did successfuly a change in .profile:
...
if [ `tty` = "/dev/console" ]
then
export TERM=hp
else
tipo_terminal=`tty|cut -f 4 -d "/"`
if [ `expr $tipo_terminal : '.*'` -eq 1 ]
then
export DISPLAY="IP_ADDRESS:0.0"
xhost + IP_ADDRESS
else
export TERM=vt220
fi
fi
...
But, I didn't understand why `expr $tipo_terminal : '.*'` returns the tipo_terminal variable length and would like to understand (I saw this as an example in expr manual)
Thanks,
Eric Antunes
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2006 10:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2006 10:05 PM
03-14-2006 10:05 PM
Re: Why `expr $VAR : '.*'` return the length of VAR?
Read section Parameter Substitution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2006 10:08 PM
03-14-2006 10:08 PM
Re: Why `expr $VAR : '.*'` return the length of VAR?
EVERYTHING is equal to '.*'...
Thanks Peter,
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2006 10:10 PM
03-14-2006 10:10 PM
Re: Why `expr $VAR : '.*'` return the length of VAR?
expr : expr
The matching operator : compares the first argument with the second argument which must be a regular expression. expr supports the Basic Regular Expression syntax (see regexp(5)), except that all patterns are ``anchored'' (i.e., begin with ^) and, therefore, ^ is not a special character, in that context. Normally, the matching operator returns the number of characters matched (0 on failure). Alternatively, the \(...\) pattern symbols can be used to return a portion of the first argument.
http://docs.hp.com/en/B2355-60127/expr.1.html
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2006 03:31 AM
03-15-2006 03:31 AM