Environment partitioning in ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Environment partitioning in ksh
# 1  
Old 10-15-2013
Environment partitioning in ksh

Hi

I am not sure if this is possible.

What I need to do is run multiple instances of a script in parallel with different output paths from a single driver script, ie,

driver.ksh:

Code:
#!/bin/ksh

num=1
sed s/DUMMY/${num}/g script.template > script.ksh
./script.ksh &
num=2
sed s/DUMMY/${num}/g script.template > script.ksh
./script.ksh &


script.template:

Code:
#!/bin/ksh

num=DUMMY
export out_path=/home/${num}
etc...


The variable $num is set by the driver script and used by script.ksh to create an environment variable which defines the output path, among other things.

I cannot change the name of the environment variable or the fact that it IS an environment variable.

What I'd like to know is if it is possible to run each instance of script.ksh within its own separate environment, with it's own definition of $out_path.

Cheers

Last edited by Franklin52; 10-15-2013 at 02:57 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 10-15-2013
Overwriting a shell script while it is executed by the shell will produce random nonsense. Either choose different scriptnames, like script1.ksh, script2.ksh or put them into different directories.
# 3  
Old 10-15-2013
or use arguments
Code:
./script.ksh 1 &
./script.ksh 2 &

and parameters
Code:
num=$1

The environment is private - there is no conflict.
# 4  
Old 10-15-2013
hergp sorry, this is an idealised example. I should have shown the script names to be different, as they are in the actual code.

Thanks MadeInGermany, this works for me.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Need help Partitioning

I am getting ready to install RHEL6 server. I have to create these partitions: / 10GB SWAP 3GB /opt/kent 10GB /opt/kent/logs /backup 20 GB Will Gparted do this? or whats the easiest way? or even a tutorial?I am so new to this (4 Replies)
Discussion started by: linux4noob
4 Replies

2. Shell Programming and Scripting

Partitioning in AIX

I am working in AIX ver 5 rel 3. It shows as follows. @:on(cluster302)/home/abcde00-> shiusr1c is LPAR (Logical PARtition). Then what is "shiissra" called? Thanks Krishna Please use code tags next time for your code and data. (1 Reply)
Discussion started by: kmanivan82
1 Replies

3. Solaris

Partitioning Question

I was told that on the bootable drive, slice 02 is reserved for system usage. Is this true? In our deployment each server is equipped with a hardware RAID adapter. The current plan is to create the slices as follows: c1t0d0s0 = swap 16386 c1t0d0s1 = /var 15366 c1t0d0s2 = / free Does this... (4 Replies)
Discussion started by: msarro
4 Replies

4. Ubuntu

About partitioning

Hi folks, Ubuntu 10.04-1 64-bit HD - 1T SATA3 I ran graphic installation installing Ubuntu-10.04-1 desktop from Live CD The partition on the new HD is as follow; /root /home /kvm (kvm is for keeping the guests of KVM, the virtualizer) Installion went through without problem abd... (0 Replies)
Discussion started by: satimis
0 Replies

5. Red Hat

Partitioning?

Hey, this question is generated purely out of my lack of knowledge. Ok, obviously you can partition hard drives, I have Windows 2k, and can partition it from administrative tools, however, all of the help sections have utterly failed to give me any information other than "when you partition, it... (5 Replies)
Discussion started by: Mal_Zapatos
5 Replies

6. UNIX for Dummies Questions & Answers

command completion in .sh or .ksh in AIX environment

How do you user command completion in .sh or .ksh in AIX environment? I know you can do it by hitting <esc><esc> in bash, but how do you do it in bourne or korn shell in AIX 5.3 environment? Thanks in advance. (1 Reply)
Discussion started by: pdtak
1 Replies

7. UNIX for Dummies Questions & Answers

Getting 'out of range' when partitioning

Hello, Using Solaris 10. Going to mirror disks with solstice disksuite. Documentation says I have to make both disks partitioned exactly the same before moving on. Here's the layout of c1t0d0 Part Tag Flag Cylinders Size Blocks 0 root wm 1237 - 2473 6.00GB (1237/0/0) 12587712 ... (1 Reply)
Discussion started by: pmichner
1 Replies

8. UNIX for Dummies Questions & Answers

Partitioning

Hiya folks, Before I install Linux, I want to partition my HD, basically I want to split my 80GB HD in half so I can run Linux but still keep Windows XP. I tried doing through the windows workstation and browsing the XP help files but it either didnt work or I was doing something wrong. I dont... (7 Replies)
Discussion started by: Mr_Pinky
7 Replies

9. UNIX for Dummies Questions & Answers

Partitioning HD

I would like to install Redhat 7.2 on my Windows machine. I only have one hard drive and I dont want to lose Windows. Which method is best for partitioning the HD? I tried it once with Partition Magic and I was installing Corel Linux First Edition and Corel wiped out my entire HD (not good when... (2 Replies)
Discussion started by: primal
2 Replies

10. UNIX for Dummies Questions & Answers

Partitioning

I'm looking for a Partitioning Tool preferably with a GUI preferably free that is easy to use if anyone has any suggestions they will be greatfully recieved, Thanks. (4 Replies)
Discussion started by: OSNovice
4 Replies
Login or Register to Ask a Question