Solved

TCL variable use in wscp

Posted on 2002-06-10
5
221 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 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
recursion example 16 124
vmware vcenter install/upgrade issue 6 115
Plain Text Editor for iPad 6 75
how to use laptop or pad camera in vb.net windows application 2 70
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This is about my first experience with programming Arduino.
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 …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

816 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now