Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TCL variable use in wscp

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

916 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