Open Source Development Tutorials | Newsletter Signup | About Us
Search  

Go Back   Open Source Tutorials Forum > Programming Languages > Perl Programming
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-18-2006, 02:08 AM
pawan.sangal pawan.sangal is offline
Junior Member
 
Join Date: Jun 2006
Posts: 3 pawan.sangal is on a distinguished road
Unhappy Plzz. Help me solving this problem?

Hi,
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 :
pawan.sangal@interglobetechnologies.com, or
sangal_urgent@yahoo.com

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

Last edited by pawan.sangal : 07-18-2006 at 02:12 AM.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



All times are GMT -5. The time now is 06:02 PM.


Powered by: vBulletin Version 3.0.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright 2004 - 2006 GrindingGears.com. All Rights Reserved.