problem with set command in korn shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problem with set command in korn shell
# 1  
Old 02-23-2006
problem with set command in korn shell

I have to copy an array to a temp variable and back after doing some functions. I am trying to see if it is possible to do without while loops.My closest try was

set -A temp ${THE_ARRAY[*]}

# restore array after some actions
set -A THE_ARRAY ${temp[*]}

The problem with above is that, the new restored array starts from 0 (subscript), instead of 1. This is very bad for my rest of the script, does anyone know a solution to this problem
# 2  
Old 02-23-2006
Not sure that I understand what you want, but try this:

set -A THE_ARRAY garbage ${temp[*]}
unset THE_ARRAY[0]
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Korn shell. wait command and crontab

I have the following ksh script: sqlplus usr1/pw1@DB1 @$DIR/a.sql $1 & sqlplus usr2/pw2@DB2 @$DIR/b.sql $1 & wait echo "Done!" Where $DIR is a variable with the absolute path where a.sql and b.sql are. For some time, I've been running this script daily and it works fine. The intentions is... (5 Replies)
Discussion started by: acarpio89
5 Replies

2. Shell Programming and Scripting

self-learning! my korn shell problem

i am a beginner i m learning shell by myself i have problem writing a korn shell that takes an absolute pathname to directory and display all ordinary files in the directory ordered by their length. i was thinking use grep ls sort and sed. maybe, i m wrong! can someone tell me? (2 Replies)
Discussion started by: babuda0059
2 Replies

3. Shell Programming and Scripting

korn shell display lenght problem!!! i got stuck on this

Using the KSH, write a shell script called display_by_length, which takes an absolute pathname to a directory and displays all ordinary files in the directory ordered by their length; for each file listed, display the name of the file and its length - nothing else. Extend this script to take an... (1 Reply)
Discussion started by: babuda0059
1 Replies

4. Shell Programming and Scripting

unix korn shell leap years problem

Write a function called dateToDays that takes three parameters -a month string such as Sep, a day number such as 18, and a year number such as 1962-and return s the number of days from January 1, 1900, to the date. Notes: I am asking you to account for leap years. my script is not... (0 Replies)
Discussion started by: babuda0059
0 Replies

5. Shell Programming and Scripting

Find command in Korn Shell

Hi, I am trying to execute the below in Ksh (telnet) find ./request.txt -mmin -30 It says find: bad option -mmin What i am trying to do is by using find command i am checking wheather the file request.txt is there for 30 minutes or not Please help (1 Reply)
Discussion started by: chinniforu2003
1 Replies

6. Shell Programming and Scripting

AIX Korn shell sed -s problem

In a Korn shell script I have, cat ../header | sed -e 's/flag1/$cnumb/g' > header.txt The header is short {{Company flag1}} But the result in header.txt is {{Company $cnumb}} The value of $cnumb is 120. I am trying to get the value of $cnumb into the header. I have tried /'$cnumb'/g,... (10 Replies)
Discussion started by: jcarrott
10 Replies

7. Shell Programming and Scripting

korn shell automation problem!

I got the task writting Korn Shell script to automate the tuxedo login so that users neednot have to enter options manually. I have done that using expect tool from the Unix but my manger told me its not secure so you have to do that using Kornshell without using Expect. Here is the way to login to... (0 Replies)
Discussion started by: pareshan
0 Replies

8. Shell Programming and Scripting

Problem with Korn Shell

My Korn shell script below is giving me the following error: ./test.ksh: 0403-057 syntax error at line 7 : 'then' is not matched. Can anyone provide a quick solution as to why the error is occurring? Thanks. #!/usr/bin/ksh typeset -i RecCount typeset -i RecCount2 RecCount=`db2 -x "select... (23 Replies)
Discussion started by: sasaliasim
23 Replies

9. UNIX for Dummies Questions & Answers

problem extracting substring in korn shell

hi all, I have read similiar topics in this board, but i didn' t find the posting which is the same with the problem i face.. I try to extract string from the end. i try to do this: num=abcdefghij num2=${num:-5} echo $num2 #this should print the last 5 characters (fghij) but it doesn;t... (3 Replies)
Discussion started by: nashrul
3 Replies

10. Shell Programming and Scripting

Command ignored after sftp - korn shell

Hi all Trying to run my korn shell script, I got no messages after the sftp. The "finished" msg is not being displayed. Any ideas? sftp $argument <<EOF quit EOF echo "finished" Thanks in advance, :O) (1 Reply)
Discussion started by: alienET
1 Replies
Login or Register to Ask a Question