I need some help to setup some environmental variables.
for example...Get A -> userdefined/user input
B -> a number.
c -> system variable...for example $GETCONF PAGE_SIZE
E = do some math using bc
display a message "The value is E"
setup the system/kernel paramter sysctl -p <parameter name> = E
setu of system/kernel paramter completed.
Here are some untested code snippets setting variables as you requested:
If you using a POSIX conforming shell (such as bash and ksh) and you're doing integer arithmetic, you don't need to call bc; you can use:
instead.
If you're doing floating point arithmetic and you're using a 1993 or later version of the Korn shell, you can still use the above arithmetic evaluation instead of calling bc, but you'll want to change the format for printing $E to a floating format such as:
where the number shown in red above specifies the number of digits you want to appear after the radix character in your output.
This User Gave Thanks to Don Cragun For This Post:
If have
var='$variable'
how can I expand $variable.
I have tried many thing like duble quotes/braces etc, but nothing worked.
I need the solution ASAP. (2 Replies)
Hi everybody:
I have a problem about use variables. I 've created this variable:
var=`wc -l file.txt | cut -c 1-2`;
n_var="$var"-1 ;
echo $n_var;
In my case var is 8.
When echo shows $n_var does not appear as I want. The question is how can I subtract, this is operate, to my variable.... (1 Reply)
In a line such as:
echo -n "How many days back would you like to check? "; read days
How can I ensure that the user has a.) entered a number between 1-30 (not 0 or 31+) and b.) has not just hit enter (ie set it to "") and if it's entered wrong, how do I start the if statement over?
I... (10 Replies)
I am working on a SunFire 480 - uname -a gives:
SunOS bsmdb02 5.9 Generic_112233-08 sun4u sparc SUNW,Sun-Fire-480R
I am tyring to sum up the total size of all the directories for each running database using awk:
#!/usr/bin/ksh
for Database in `ps -efl | grep "ora_pmon" | grep -v grep |... (1 Reply)
Hi,
I am wondering what is the difference between the USER and LOGNAME environment variables, and under what situations would they be different?
I am using Ubuntu 8.04 32-bit and I do not have 'login' command to test it. (7 Replies)
I need some help to write a ksh script.
My code so far (pretty bad, sorry):
#! /bin/ksh
echo "Calculate average"
UserDecision=y
while test $UserDecision = y
do
echo "Enter a number: "
read Number1
echo "Enter a number: "
read Number2
echo "Do you want to enter another number?... (2 Replies)
Hi everyone,
I wrote a script that is supposed to be run by cron on a daily basis. It works just fine if I run it manually, but due to a lack of environment variables (which are available during my user session but not when cron runs the script) it keeps failing to run successfully.
Here's the... (2 Replies)
Hello... and thanks in advance for any help anyone can offer me with my question! I'm hoping someone will have a little patience with me and walk me through this!
I'm trying to understand a user login process on Centos 7 and I've gotten a bit confused trying to figure out when/how a Gnome... (4 Replies)
I have some comments about a previously closed topic whose name is the same as above
Omitted from the discussion was the situation with a "sudo command or sudo within a script".
There is an inconsistency between systems. On some systems $LOGNAME is invariant, on others,
on RedHat sudo... (3 Replies)
Discussion started by: lsatenstein
3 Replies
LEARN ABOUT DEBIAN
symdiff
symdiff(3tcl) Symbolic differentiation for Tcl symdiff(3tcl)__________________________________________________________________________________________________________________________________________________NAME
symdiff - Symbolic differentiation for Tcl
SYNOPSIS
package require Tcl 8.5
package require grammar::aycock 1.0
package require math::calculus::symdiff 1.0
math::calculus::symdiff::symdiff expression variable
math::calculus::jacobian variableDict
_________________________________________________________________DESCRIPTION
The math::calculus::symdiff package provides a symbolic differentiation facility for Tcl math expressions. It is useful for providing de-
rivatives to packages that either require the Jacobian of a set of functions or else are more efficient or stable when the Jacobian is pro-
vided.
PROCEDURES
The math::calculus::symdiff package exports the two procedures:
math::calculus::symdiff::symdiff expression variable
Differentiates the given expression with respect to the specified variable. (See Expressions below for a discussion of the subset of
Tcl math expressions that are acceptable to math::calculus::symdiff.) The result is a Tcl expression that evaluates the derivative.
Returns an error if expression is not a well-formed expression or is not differentiable.
math::calculus::jacobian variableDict
Computes the Jacobian of a system of equations. The system is given by the dictionary variableDict, whose keys are the names of
variables in the system, and whose values are Tcl expressions giving the values of those variables. (See Expressions below for a
discussion of the subset of Tcl math expressions that are acceptable to math::calculus::symdiff. The result is a list of lists: the
i'th element of the j'th sublist is the partial derivative of the i'th variable with respect to the j'th variable. Returns an error
if any of the expressions cannot be differentiated, or if variableDict is not a well-formed dictionary.
EXPRESSIONS
The math::calculus::symdiff package accepts only a small subset of the expressions that are acceptable to Tcl commands such as expr or if.
Specifically, the only constructs accepted are:
o Floating-point constants such as 5 or 3.14159e+00.
o References to Tcl variable using $-substitution. The variable names must consist of alphanumerics and underscores: the ${...} nota-
tion is not accepted.
o Parentheses.
o The +, -, *, /. and ** operators.
o Calls to the functions acos, asin, atan, atan2, cos, cosh, exp, hypot, log, log10, pow, sin, sinh. sqrt, tan, and tanh.
Command substitution, backslash substitution, and argument expansion are not accepted.
EXAMPLES
math::calculus::symdiff::symdiff {($a*$x+$b)*($c*$x+$d)} x
==> (($c * (($a * $x) + $b)) + ($a * (($c * $x) + $d)))
math::calculus::symdiff::jacobian {x {$a * $x + $b * $y}
y {$c * $x + $d * $y}}
==> {{$a} {$b}} {{$c} {$d}}
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math ::
calculus of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may
have for either package and/or documentation.
SEE ALSO
math::calculus, math::interpolate
COPYRIGHT
Copyright (c) 2010 by Kevin B. Kenny <kennykb@acm.org>
Redistribution permitted under the terms of the Open Publication License <http://www.opencontent.org/openpub/>
math 1.0 symdiff(3tcl)