07-18-2008
One thing you might try is using the double parens math workings of bash. Quite cool and is readable, and it avoids your shell expansion problem. Secondarily, a "here" document with the "dc" program is how I used to do it. e.g.:
dc <<EOF
2 20 * p
EOF
will produce 40 as output
Using the double-parens syntax of bash, one can do this:
$i=0
((i=2*20))
echo $i <-- produces 40
Kinda cool, huh?
Last edited by fsahog; 07-18-2008 at 11:47 PM..
Reason: To illustrate more fully
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hallo everyone,
This is my problem below:
/home/cerebrus/pax=>vat class2.sh
ksh: vat: not found
/home/cerebrus/pax=>cat class2.sh
#!/bin/ksh
set -x
bdf|grep appsdev|awk '{ print $5 }'> class3
dd={cat class3}
echo $dd
/home/cerebrus/pax=>
/home/cerebrus/pax=>./class2.sh
+ bdf
+... (8 Replies)
Discussion started by: kekanap
8 Replies
2. UNIX for Advanced & Expert Users
I need to pass a parameter to a function in a script. My parameter is a string. When I display the parameter within my function, I only get the first word from string I pass in.
How can I make the function receive the whole string (and not terminate at the first space it encounters)?.
part of... (2 Replies)
Discussion started by: fastgoon
2 Replies
3. Programming
Hi,
How to pass parameter to makefile?
Please let me know if any one knows and also please put an example of makefile with this feature.
thanks,
Manju. (3 Replies)
Discussion started by: manju_p
3 Replies
4. Shell Programming and Scripting
I'm writing a script that will ssh to a number of hosts and run commands. I'm a bit stumped at the moment as some of the commands that I need to run contain wildcards (i.e. *), and so far I have not figured out how to escape the * character so the script doesn't expand it. More specifically, here's... (9 Replies)
Discussion started by: GKnight
9 Replies
5. Shell Programming and Scripting
Hi,
PW='/as sysdba'; export PW
in other module I call sqlplus ${PW} (this line I unable to change!)
How I can define PW so that sqlplus calls PW in quotes i.e sqlplus '/as sysdba'
I tried like this
PW="'/as sysdba'"; export PW - no luck
Thanks in advance (2 Replies)
Discussion started by: zam
2 Replies
6. Shell Programming and Scripting
Hi All,
When passing parameters to a sheel script, the parameters are referenced by their positions such as $1 for first parameter, $2 for second parameter. these positional values can only have values ranging from $0-$9 (0,1,2,3...9).
I have a shell script meant to accept 20 parameters. for... (3 Replies)
Discussion started by: ogologoma
3 Replies
7. Programming
I am surprised by GCC (this is ver. 4.2.4, Ubuntu 32 bit Intel) when a function declares a float parameter and it's prototype is missing, the parameters are messed up.
Please see my code below:
~/test$ cat x1.c
#include <stdio.h>
#include <stdlib.h>
set_p(int p1, float p2, int p3, int p4)... (7 Replies)
Discussion started by: migurus
7 Replies
8. Shell Programming and Scripting
i am passing input parameter 'one_two' to the script , the script output should display the result as below
one_1two
one_2two
one_3two
if
then
echo " Usage : <$0> <DATABASE> "
exit 0
else
for DB in 1 2 3
do
DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}`
done
fi (5 Replies)
Discussion started by: only4satish
5 Replies
9. Shell Programming and Scripting
Hi,
I've written a script where eleven parameter to be passed from command line
which is inserting into an oracle table,
it is working but the tenth and 11th parameter are not accepting as given
it is referring to 1st parameter.
HERE IS THE SCRIPT
#!/bin/ksh
#set -o
echo $*... (4 Replies)
Discussion started by: sankar
4 Replies
10. Shell Programming and Scripting
Hi ,
I am passing date parameter through file
my shell script testing.sh is
#set -x
#set -v
asd=$1
asd1=$2
echo $asd
echo $asd1
Passing parameter as below
sh testing.sh `cat file1.txt`
Output (2 Replies)
Discussion started by: kaushik02018
2 Replies
tntnet(8) Tntnet users guide tntnet(8)
NAME
tntnet - web application server for c++
SYNOPSIS
tntnet [-c file] [--logall]
tntnet -C [-q query-string] [componentId ...]
DESCRIPTION
This manual page documents briefly the tntnet command.
tntnet is a web server that can generate dynamic content via precompiled C++ modules.
OPTIONS
A summary of options is included below.
-c file
Use file as the configuration file. If the -c is omitted, the first nonoption argument is used as the config file.
--logall
Initialize logging earlier. Normally logging is initialized after starting the listeners and changing user so that logfiles are cre-
ated with the right owner. For debugging reasons this option forces to do that earlier.
-C Call components and print the result to stdout instead of starting tntnet as a webserver
-q query-string
In -C mode pass this query string to the component. The option may be repeated multiple times to pass name-value-pairs easily.
EXAMPLE
tntnet -C -q arg1=35 -q arg2=7 -q op=/ calc@calc
calls the component calc@calc with query parameters and prints the result to stdout.
FILES
/etc/tntnet/tntnet.conf The default configuration file.
ENVIRONMENT
TNTNET_CONF
This is checked for the configuration file name if it is not specified on the command line.
AUTHOR
tntnet was written by Tommi Makitalo <tommi@tntnet.org>.
This manual page was written by Kari Pahula <kaol@debian.org>, for the Debian project (but may be used by others).
SEE ALSO
tntnet-config(1), ecpp(7), ecppc(1), ecppl(1), ecppll(1), tntnet.conf(7), tntnet.properties(7).
More documentation can be found in /usr/share/doc/tntnet-doc/.
Tntnet July 23, 2006 tntnet(8)