Can someone explain the difference between backticks and system when
evaluated in these if statements:
sub getDate {
print "start date\n";
if ( system("/bin/date") ) {
print "can't get date\n";
exit(2);
}
print "finish date\n";
}
Returns the following:
start date
Thu... (5 Replies)
Hi,
I would like to change some lines in my mysql-dump, because there a syntax problems with some version of mysql.
I 'd like to change
USE ´someDatabase´;
to
USE someDatabase;
(without backticks) using the sed command in the shell
Thanks & best regards
Bernd (5 Replies)
I'm always concerned I might be abusing backticks within my scripts. A current script I'm writing has this for example:
stripscriptname=`echo $scriptname | sed 's/\(.*\)\..*/\1/'`
stripsearch=`echo $searchpattern | tr -d ' ,/'`
Both of these variables are set inside the script (in fact,... (2 Replies)
Hey all. Just a fast question, what is the technical difference between using back ticks and using xargs to perform a command?
Here's an example
Find /mydir -name *.conf |xargs rm
Vs
Rm 'find /mydir -name *.conf'
Is there a performance hit? I know they do the same thing but which is... (1 Reply)
Hi everyone. This is a bit of a perl/linux mixed question. I am trying to redirect STDOUT of chsh by using the following line of perl code.
system ("chsh -s /sbin/nologin $testing 1>/dev/null");
This should redirect STDOUT to /dev/null but it won't do that for some odd reason. Any ideas or... (6 Replies)
Input file:
'data_1'
'data_10'
'data1311'
'235data_13'
Desired output:
data_1
data_10
data1311
235data_13
Can I know how to remove back tick"'" in a file?
Many thanks for advice. (3 Replies)
Hi all,
Here is my code:
my $x = `bash -c \" ls -l filename | awk '{print \$5}'\"`;
print "$x\n";
This will run the first part of the bash script but not the awk command. It therefore gives output of:
-rw-r--r-- 1 root root 13619200 2012-04-25 08:16 filename
I am actually trying to... (0 Replies)
I have been testing a new script and cannot figure out why my `cat spath` will not execute on the remote machine?
sudo ssh -p 22344 -o "PasswordAuthentication no" -o "HostbasedAuthentication yes" -l testuser 192.168.1.6 "find `cat spath` -depth"
cat: spath: No such file or directory
but... (0 Replies)
I'm trying to make a dialog window that prints the output of grep that takes the output of find. Unfortunately my nested backticks don't work.
Here is the dialog window:
dialog --stdout --title "test" --backtitle "test" --msgbox "Test:\n `grep -l "${tablica}" `find $string``" 16 60I think I... (2 Replies)
But I love my back-ticks - I know exactly how to escape them (after too many years) - I always seem to end unbalanced with ().
However, I shall take the hint. (One more trick for this dog... aka - not too old yet!) :);) (17 Replies)
Discussion started by: MichaelFelt
17 Replies
LEARN ABOUT SUSE
tcl_exprboolean
Tcl_ExprLong(3) Tcl Library Procedures Tcl_ExprLong(3)__________________________________________________________________________________________________________________________________________________NAME
Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString - evaluate an expression
SYNOPSIS
#include <tcl.h>
int
Tcl_ExprLong(interp, expr, longPtr)
int
Tcl_ExprDouble(interp, expr, doublePtr)
int
Tcl_ExprBoolean(interp, expr, booleanPtr)
int
Tcl_ExprString(interp, expr)
ARGUMENTS
Tcl_Interp *interp (in) Interpreter in whose context to evaluate expr.
const char *expr (in) Expression to be evaluated.
long *longPtr (out) Pointer to location in which to store the integer value of the expression.
int *doublePtr (out) Pointer to location in which to store the floating-point value of the expression.
int *booleanPtr (out) Pointer to location in which to store the 0/1 boolean value of the expression.
_________________________________________________________________DESCRIPTION
These four procedures all evaluate the expression given by the expr argument and return the result in one of four different forms. The
expression can have any of the forms accepted by the expr command. Note that these procedures have been largely replaced by the object-
based procedures Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, and Tcl_ExprObj. Those object-based procedures evaluate an
expression held in a Tcl object instead of a string. The object argument can retain an internal representation that is more efficient to
execute.
The interp argument refers to an interpreter used to evaluate the expression (e.g. for variables and nested Tcl commands) and to return
error information.
For all of these procedures the return value is a standard Tcl result: TCL_OK means the expression was successfully evaluated, and
TCL_ERROR means that an error occurred while evaluating the expression. If TCL_ERROR is returned then the interpreter's result will hold a
message describing the error. If an error occurs while executing a Tcl command embedded in the expression then that error will be
returned.
If the expression is successfully evaluated, then its value is returned in one of four forms, depending on which procedure is invoked.
Tcl_ExprLong stores an integer value at *longPtr. If the expression's actual value is a floating-point number, then it is truncated to an
integer. If the expression's actual value is a non-numeric string then an error is returned.
Tcl_ExprDouble stores a floating-point value at *doublePtr. If the expression's actual value is an integer, it is converted to floating-
point. If the expression's actual value is a non-numeric string then an error is returned.
Tcl_ExprBoolean stores a 0/1 integer value at *booleanPtr. If the expression's actual value is an integer or floating-point number, then
they store 0 at *booleanPtr if the value was zero and 1 otherwise. If the expression's actual value is a non-numeric string then it must
be one of the values accepted by Tcl_GetBoolean such as "yes" or "no", or else an error occurs.
Tcl_ExprString returns the value of the expression as a string stored in the interpreter's result.
SEE ALSO
Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj
KEYWORDS
boolean, double, evaluate, expression, integer, object, string
Tcl 7.0 Tcl_ExprLong(3)