How to loop through array who's name is entered in command line?
Say I have a ksh program called test.ksh which has several defined arrays inside it such as array1,array2,array3...These arrays contain strings.
I also have a method in the program:
So, when the user enteres: ./test.ksh array1, I want to loop thruogh the contents of array1 using my for loop. However, with the for loop I have, the program takes the user's entry as a string and tries to perform the actions on that. How do I make it so the program will look for the array which the user enters?
Hello
Does the unix korn shell provide a function to convert number entered in command line argument to text or Character so that in next step i will convert Chr to Hex (6 Replies)
I am trying to create a script that will accept multi input from the user (really just me), then execute those command on a remote device.
My question is if the I enter "No" at the confirmation point "Are these statements correct y or n ?", what is the best way to go back and start over ? I... (3 Replies)
I have been trying this a lot of different ways and haven't found too much online. Here's what I've got so far:
j=0
declare -a first
zero=(`cat $tmpfile`)
for i in "${zero}"
do
command $i >> "${first}"
... (4 Replies)
one more question. I want to skip the first echo statement the first time the loop gets entered
while #keep prompting for more funds until selling price achieved
do
echo "You have inserted a total of ${total_inserted} cents. Please insert $total_remaining more cents"
echo... (1 Reply)
Hi all,
I need a little assistance to complete the following script. I would like to take a file with a single number on each line and for each number, run it through a command. The loop will terminate once all numbers have been checked. Here is what I have thus far...
COUNTER=`wc -l... (2 Replies)
Hi,
how to do that ? I mean only print it but not execute. I'm using putty to interact with ksh.
(in windows cmd up arrow does the job)
thanks
vilius (5 Replies)
I have a script like this--
#!/bin/ksh
echo "To pad a 0 before digits from 1-9"
for i in $*
do
echo $i | sed 's//'0'/g'
done
I run this script as
ksh name 1 2 23 34
The output should be
01 02 23 34
Help me in modifying this script.
Thanks
Namish (2 Replies)
Hi everyone,
Can someone possibly help me with this problem I am having please.
I wrote a Korn shell script to manipulate currency amounts in a way that a person could use this script to determine the minimum number of coins required to make a certain amount.
for example when entered on the... (2 Replies)