Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Just try to solveit, if you can solve

Posted by Pawan_Sangal (Pawan_Sangal), 18 July 2006
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




This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho