09-10-2014
I would turn MATRICE into an array with one character per array element. Then you just pick a random index into the array. This will work with all versions of ksh and it will be very fast.
10 More Discussions You Might Find Interesting
1. Solaris
Hi below is my script
for((i=0;i<=$TOTAL;i++))
do
echo "IP's created are $s1.$s2.$s3.$s4"
s4=`expr $s4 + 1`
done
where s1,2,3,4 are input varibles
below error occurs while running the script
syntax error at lin 11: '(' unexpected
... (12 Replies)
Discussion started by: krevathi1912
12 Replies
2. Shell Programming and Scripting
I was wondering if there is anyway to use the curses library with ksh88. I saw Shell Curses function library which says I can use /usr/local/functions/shellcurses on ksh93 but I am on ksh88. I am on a HP-UX box. (0 Replies)
Discussion started by: IMTheNachoMan
0 Replies
3. Shell Programming and Scripting
Hi all!
Does anybody know how can I check if any UNIX installation has implemented ksh88 or ksh93?
Thanks in advance.
Néstor. (3 Replies)
Discussion started by: Nestor
3 Replies
4. Shell Programming and Scripting
Hello,
ksh88 doesn't support ${var:x:y}.
Any alternatives to get substring ?
thanks
Vilius (2 Replies)
Discussion started by: vilius
2 Replies
5. Shell Programming and Scripting
Hello,
I need ksh88 for my linux system - and I don't want pdksh.
Possible to get original ksh 88 binaries or source ?
(I don't need ksh93 which is available)
thanks
Vilius (1 Reply)
Discussion started by: vilius
1 Replies
6. Shell Programming and Scripting
I have to use KSH88, so going to BASH, perl etc. is not an option.
Below is a much simplified verison of what I am doing (aka ignore my cut command and i not increasing) :)
i=1
BIGSTRING="one two three four five six seven eight"
while ]; do
typeset "STRING$i=`echo $BIGSTRING| cut -d' '... (8 Replies)
Discussion started by: nitrobass24
8 Replies
7. Shell Programming and Scripting
Hi,
With:
# VALUES="one~two~~~"
# echo $VALUES | awk 'BEGIN {FS="~"} {print NF}'
5
I can determine the number of fields.
How to determine the number of fields with a value ?
In this case 2.
Thanks in advance,
ejdv (6 Replies)
Discussion started by: ejdv
6 Replies
8. Shell Programming and Scripting
Hi I tried the following string comparison script in Ksh88
#!/bin/ksh
str1='aC'
str2='ABC'
if
then
echo "Equal"
else
echo "Not Equal"
fi
Though str1 and str2 are not equal the script output says Equal .
Please correct me
Thanks (2 Replies)
Discussion started by: smile689
2 Replies
9. Shell Programming and Scripting
Hi I tried the following code to FTP the files from test server to dev
#!/bin/ksh
DST=/home/files
cd $DST
ftp -inv 'test_serv101' << EOF
quote USER test
quote PASS test
# File Path on test server
cd /etc/home/Or_Files
ascii
mget curMonth* $DST
quit
EOF
when i try the above code it... (4 Replies)
Discussion started by: smile689
4 Replies
10. OS X (Apple)
I don't know if anyone is interested but I have been meddling with FFT for the AMIGA.
(Sadly we AMIGAns don't have these luxuries through any scripting language.
Below is a Python snippet that uses the builtin 'cmath' module to work with the lowly
Python 2.0.1 for the AMIGA. It is part of a... (0 Replies)
Discussion started by: wisecracker
0 Replies
set(3tcl) Tcl Built-In Commands set(3tcl)
__________________________________________________________________________________________________________________________________________________
NAME
set - Read and write variables
SYNOPSIS
set varName ?value?
_________________________________________________________________
DESCRIPTION
Returns the value of variable varName. If value is specified, then set the value of varName to value, creating a new variable if one does
not already exist, and return its value. If varName contains an open parenthesis and ends with a close parenthesis, then it refers to an
array element: the characters before the first open parenthesis are the name of the array, and the characters between the parentheses are
the index within the array. Otherwise varName refers to a scalar variable.
If varName includes namespace qualifiers (in the array name if it refers to an array element), or if varName is unqualified (does not
include the names of any containing namespaces) but no procedure is active, varName refers to a namespace variable resolved according to
the rules described under NAME RESOLUTION in the namespace manual page.
If a procedure is active and varName is unqualified, then varName refers to a parameter or local variable of the procedure, unless varName
was declared to resolve differently through one of the global, variable or upvar commands.
EXAMPLES
Store a random number in the variable r:
set r [expr {rand()}]
Store a short message in an array element:
set anAry(msg) "Hello, World!"
Store a short message in an array element specified by a variable:
set elemName "msg"
set anAry($elemName) "Hello, World!"
Copy a value into the variable out from a variable whose name is stored in the vbl (note that it is often easier to use arrays in practice
instead of doing double-dereferencing):
set in0 "small random"
set in1 "large random"
set vbl in[expr {rand() >= 0.5}]
set out [set $vbl]
SEE ALSO
expr(3tcl), global(3tcl), namespace(3tcl), proc(3tcl), trace(3tcl), unset(3tcl), upvar(3tcl), variable(3tcl)
KEYWORDS
read, write, variable
Tcl set(3tcl)