Help with Nested Sourcing files.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with Nested Sourcing files.
# 1  
Old 05-01-2009
Help with Nested Sourcing files.

Hi,

I have a script
Code:
#!/bin/ksh
#reading parameters.
. FileA
Echo ......
......

File A has all parameters.

FileA:
Infile=xyz.com
outfile=abc.com
#Userid file
. FileB


FileB:
Userid:ABC
Passwd:XYZ

If i have userid and passwd in FileA script works.
But if i put userid and passwd in FileB
Script Fails complaining FileB not found (even if i give pull fileB path)
I need to keep userid and passwd in FileB and not In FileA


Appreciate your help.
# 2  
Old 05-02-2009
could you explain in detail what you are trying to archive?
# 3  
Old 05-02-2009
I guess (Bash here, sorry ...) you'd have to either turn FileA into a script as well to get the source command interpreted ...

Code:
#! /bin/ksh
Infile=xyz.com
outfile=abc.com
source FileB

... or - possibly cleaner / easier - source both files from the main script:

Code:
#! /bin/ksh
source FileA
source FileB

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue with sourcing a file

I have a issue.sh script more issue.sh #!/bin/bash -e echo "start" source ~/.moht echo "end" Contents of ~/.moht are as below more ~/.moht umask 022 export EDITOR=vi SYSNM=`uname -n` UID=`id` HOST=`hostname` Executing of issue.sh throws the below error (1 Reply)
Discussion started by: mohtashims
1 Replies

2. UNIX for Dummies Questions & Answers

Question On Sourcing Variables

I have 2 scripts first script would call second script. test1.sh #!/bin/bash logfile=`basename $0`.log echo "First File" >> $logfile TIME=`ls -lu array.ksh | awk '{print $6" "$7" "$8}'` . /home/infrmtca/bin/Test/test2.sh #/home/infrmtca/bin/Test/test2.sh test2.sh #!/bin/bash... (1 Reply)
Discussion started by: Ariean
1 Replies

3. Shell Programming and Scripting

Sourcing as root automatically

Hey everyone! I have my .bash_profile file which is read automatically when I launch Terminal therefore I can run my own functions. BUT. When I do: sudo -s sudo su sudo su - No matter what I do, I can't get the .bash_profile file to be sourced automatically so I end up having to run... (2 Replies)
Discussion started by: dasx
2 Replies

4. Red Hat

Crontab sourcing PATH?

Hi, Im trying to run script A which requires path /sbin. I have a crontab entry to run script A every 10 minutes. Script A is executed fine by cron, but because script A requires /sbin in its path it fails to run. My situation is script A get overwritten from time to time so I can't modify... (4 Replies)
Discussion started by: wilsonee
4 Replies

5. Shell Programming and Scripting

Bourne: $0 issues when sourcing files

Problem in simple script form: File 1: # cat test.sh #!/bin/sh echo "Running test.sh - \$0 is $0" echo "Sourcing test2.sh" . ./test2.sh exit File 2 (Sourced file): # cat test2.sh #!/bin/sh echo "Running test2.sh - \$0 is $0" exit Output: # ./test.sh Running test.sh - $0 is ... (1 Reply)
Discussion started by: Vryali
1 Replies

6. Shell Programming and Scripting

Nested loops for copying files on different machines

I want to run nested loop inside shell script using which I want to copy files on diff machines on round robin basis.Number of machiines is fixed as 4 but number of files may vary. For eg. Files: f1,f2,f3,f4,f5,f6 Machines: M1,M2,M3,M4 M1 - f1 M2 - f2 M3 - f3 M4 - f4 M1 - f5 M2 - f6 ... (1 Reply)
Discussion started by: baig_1988
1 Replies

7. UNIX for Dummies Questions & Answers

Nested for loops for checking duplicate files

I am very new to bash scripting and this is my first script. I am trying to write a script that takes an argument d as the directory. It looks through the files to find duplicates and delete them. Here's some sorta-pseudocode but am unsure how to implement it: #! /bin/bash #get... (1 Reply)
Discussion started by: shubham92
1 Replies

8. Shell Programming and Scripting

sourcing .profile for other users

Hi Team, Thank you for your time. i have a situation where the user IDs of the applicatio users have been locked down to Read only. Hence I am writing a script to invoke their old .profile every time they login. My problem is : when i run . $userpath/.profile from within the ksh script... (9 Replies)
Discussion started by: anitha111
9 Replies

9. UNIX for Dummies Questions & Answers

sourcing the .bashrc

Hello, I am quite new to Linux... I need to set some aliases and I can't get it to work. Can somebody tell me what's wrong? I modified the .bashrc file in my home directory. I added: alias pmv= '/home/vera/MGLTools-1.4.5/share/bin/pmv' saved it and ran source .bashrc The shell... (3 Replies)
Discussion started by: Nusy
3 Replies

10. Shell Programming and Scripting

comparing 2 files using nested for loop

hi, Am trying to compare to files using the 'for' loop have tried this but keeps going on and on.. #!/bin/bash for i in $(cat $c.sh); do for j in $(cat $d.sh); do if test "$i" != "$j" then echo $i not in $j fi done done have tried this as... (0 Replies)
Discussion started by: vadharah
0 Replies
Login or Register to Ask a Question