Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > Other Programming Languages
|
Other Programming Languages If you have a coding issue to discuss about another language that really isn't provided for in any other forum here (not ASP.NET C#, C++, VB, PHP, JavaScript, Python, Java, Perl, Applescript, XML or any of the other forum topics we have), post it here. Enough discussion on a language we don't have covered could prompt a new forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Other Programming Languages section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 18th, 2006, 02:59 AM
Registered User
 
Join Date: Jun 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Just try to solve it, if you can solve

I'm facing a confusion with Pattern Matching operators in my BASH.
Suppose, I have

$cd /home/db
$ ls -l
lrwxrwxrwx 1 ef ef 27 Aug 19 2004 dtest -> /home/dbtest//
lrwxrwxrwx 1 ef ef 18 Jul 7 2004 pase -> /systemlink/pbase
lrwxrwxrwx 1 ef ef 21 Apr 26 2004 pdcnt -> /systemlink/pdcnt/
lrwxrwxrwx 1 ef ef 24 Jul 20 2005 phistry -> /pf_hist1/phistry//
lrwxrwxrwx 1 ef ef 20 Jul 20 2005 pdtion -> /systemlink/pdtion/
lrwxrwxrwx 1 ef ef 21 Aug 24 2004 w1 -> /systemlink/pdcnt/

$cd /systemlink
$ ls -l
lrwxrwxrwx 1 ef ef 19 Jun 20 16:00 dbac -> /pf_hm4/dbac/
lrwxrwxrwx 1 ef ef 16 Aug 16 2005 home -> /logs/home/
lrwxrwxrwx 1 ef ef 21 Jun 20 15:59 pdcnt -> /pf_c4/pdcnt/
lrwxrwxrwx 1 ro ro 23 Aug 30 2004 phistry -> /pf_ht1/phistry/
lrwxrwxrwx 1 ef ef 11 Jun 24 2005 pdtion -> pdcnt/

All are the links in the above listing you have seen.
================================================== ==
now if in my BASH window: I'm trying

DATAB="pdtion"

v0=`ls -l /home/db|grep " ${DATAB} ->"`
echo "$v0" #------what v0 will have. please tell?
tag=${v0##* /} #----- what is there in tag. please tell?
v0=`ls -l /systemlink|grep " ${tag} ->"`
echo "$v0" #------now what v0 will have. please tell?
================================================== ==

I have also seen the other pattern matching operators like:
${v0##* /}, ${v0#* /}, ${v0%%:*}, ${v0%/*}
All of these have different means with a particular kind of line or pattern.


According to the script, its working properly to what it was built for.
But,
According to my assumption, As I'm trying this in normal shell window and had no relation with the script. If I'm trying to do the same procedure as above like echo the values of (tag) and (v0) without disturbing the script, I'm not getting that valid output, what the script is getting while executing.

Anyone, who have the answers to these queries. Please mail me at :
[email protected], or
[email protected]

I will be greatly thankful, if anybody can tell me the exact values of (tag) and (v0) as i have discussed above. If anybody have any hints please share, regarding greping of links.

Thanks & Regards,
Pawan Sangal
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Do anyone know how to solve it? triplec MySQL 1 June 24th, 2008 12:12 PM
Help to solve rajmou Javascript How-To 2 November 15th, 2007 05:21 AM
Solve the problem chandan_tandon General .NET 0 October 4th, 2006 07:00 AM
How t o solve this greek BOOK: Professional Crystal Reports for VS.NET 0 March 15th, 2006 07:58 AM
Can u solve this? rajanikrishna Classic ASP Databases 8 June 2nd, 2004 06:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.