JESS Userfunction writes “BS” instead of “/home” to a file

I'm using JESS for my expert system implementation and I have a userfunction. It writes some strings to a text file.

public Value call(ValueVector vv, Context context) throws JessException {

    Rete engine = context.getEngine();      
    int size = vv.size();

    for(i = 0; i < size-1; i++)
        params[i] = vv.get(i+1).stringValue(context); 

    engine.eval("(printout file " + params[2] + ")");
return new Value(params[1], RU.STRING);
}

params[2] has /home/username/folder as content. When it prints out to a file I get the following in the file. BS has black background btw.

BSusername/folder

I'm not sure what's going on here. Any ideas?

In addition, I've never had this problem when I print out from JESS code.

Answers


The unquoted text /home/ is being parsed as a regular expression; the printed value is somewhat unpredictable. You need to include double quotes in your built-up command so the path is seen as a quoted string.


Need Your Help

How to Convert this Smarty Code Back to PHP?

php loops for-loop smarty

From my understanding, Smarty includes a number of built-in functions that have equivalencies in PHP.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.