Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TCL variable use in wscp

Posted on 2002-06-10
5
Medium Priority
?
225 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 200 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

If you don't know how to downgrade, my instructions below should be helpful.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Simple Linear Regression

715 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