![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Scheduling crontab using parameter from XML file | michaelbz | Shell Programming and Scripting | 0 | 08-14-2007 06:49 AM |
| how do I make dynamic parameter names? Or get the value of a parameter evaluated twi | Awanka | Shell Programming and Scripting | 2 | 04-19-2007 06:37 PM |
| Reading file names from a file and executing the relative file from shell script | anushilrai | Shell Programming and Scripting | 4 | 03-10-2006 02:25 AM |
| parameter file for a shell script | bryan | Shell Programming and Scripting | 2 | 02-25-2005 09:58 AM |
| max file parameter ( urgent ) | fmmq | Filesystems, Disks and Memory | 2 | 07-25-2002 02:00 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
reading the parameter from another file
I have a script where 3 parametrs are passed to it and it creates the file for each site form a template. If i want to
get the 3rd parameter (which is the site) passed to the script to come from another file how I can change the script tp acheive it? Here is my script: Quote:
I need the 3rd parameter to be read from the another file and run it recursively to create 20 different files. The site file has 20 entries and hence it needs to create 20 files. Can some body let mw know how i can do that? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
assuming '/path/to/siteFile' containts one 'site' per line.
Code:
#!/bin/ksh
for site in $(< /path/to/siteFile)
do
update.ksh 20071912 1 "${site}"
done
|
|
#3
|
|||
|
|||
|
Vgresh,
Its not able to read the contents from site file and i am getting the below error: update.ksh 20071912 1 ./ what i have in there is : Quote:
|
|
#4
|
|||
|
|||
|
Vgresh,
Its able to read from the sites.txt but not able to run the script . Its not able to execute the script with the site parameter replaced. can you let me know the reason for site in $(/home/sravan/sites.txt) do update.ksh 20071912 1 "${site}" done |
|
#5
|
|||
|
|||
|
Vgresh,
I am getting the below error: /home/sravan/sites.txt: jon: not found /home/sravan/sites.txt[2]: ind: not found /home/sravan/sites.txt[3]: bur: not found /home/sravan/sites.txt[4]: lan: not found /home/sravan/sites.txt[5]: viz: not found /home/sravan/sites.txt[6]: vaz: not found /home/sravan/sites.txt[7]: cha: not found /home/sravan/sites.txt[8]: hon: not found /home/sravan/sites.txt[9]: hcl: not found /home/sravan/sites.txt[10]: ron: not found /home/sravan/sites.txt[11]: rap: not found /home/sravan/sites.txt[12]: jai: not found /home/sravan/sites.txt[13]: can: not found /home/sravan/sites.txt[14]: rom: not found /home/sravan/sites.txt[15]: jon: not found /home/sravan/sites.txt[16]: son: not found /home/sravan/sites.txt[17]: pan: not found /home/sravan/sites.txt[18]: cri: not found /home/sravan/sites.txt[19]: ros: not found /home/sravan/sites.txt[20]: pne: not found |
|
#6
|
||||
|
||||
|
look at my original post:
Code:
#!/bin/ksh
for site in $(< /path/to/siteFile)
do
update.ksh 20071912 1 "${site}"
done
|
|
#7
|
|||
|
|||
|
Thanks Vgresh!!!! Thats simply great.
can you let me know the significance of < here. |
|||
| Google The UNIX and Linux Forums |