Solved

TCL variable use in wscp

Posted on 2002-06-10
5
223 Views
Last Modified: 2010-08-05
I'm trying to use the lsearch functionality of TCL, and I can not understand why this variable will not evaluate to its value.  Any ideas?

set ds_mdo "/JDBCDriver:Sample DB Driver/DataSource:"
append $ds_mdo $my_datasource
append $ds_mdo "/"

# check to see if my_datasource is installed
if {[lsearch [DataSource list] {$ds_mdo}] > -1}
{
     puts 'found datasource'
}
else
{
     puts 'did not find'
}
0
Comment
Question by:nixj14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7067731
what does
   [DataSource list]
return?
0
 
LVL 1

Author Comment

by:nixj14
ID: 7067777
Alright, I've jumbled things around a little.  Now I have the following:
__________________________
set ds_mdo "mdo_30_merant"

# check to see if the MDO DataSource is already installed
if ([lsearch -regexp [DataSource list] "/JDBCDriver:Sample DB Driver/DataSource:$ds_mdo/"]>-1)
{
     puts 'found datasource'
}
else
{
     puts 'did not find'
}
__________________________
and this returns:
wrong # args: no script following "(-1>-1)" argument

DataSource List returns nothing because there is no datasources, which is fine.  What is funny is that my above script works when I'm in wscp, but not when I call wscp -f and include the text above in a file.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 7067911
# did you mean?
if {[lsearch -regexp [DataSource list] "/JDBCDriver:Sample DB Driver/DataSource:$ds_mdo/"]>-1} {
0
 
LVL 1

Author Comment

by:nixj14
ID: 7067949
Did I mention that I hate TCL??  I tried a close variation to that with the opening body bracket on the next line and I get an error message.  I was unable to find no documentation on grouping syntax with loops and conditionals.  I appreciate your help.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7068023
hate==love
:-))

It's like any language: you have to live with dragons

f.e. look at perl:
   $x=~string;   $y+=2;
   $x= ~string;  $y+ =2;
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question