Sponsored Content
Top Forums Shell Programming and Scripting Read Parameters from one file and make a script Post 302837839 by Little on Saturday 27th of July 2013 02:34:18 AM
Old 07-27-2013
check this.. if it ok for you.

Code:
i=1
while read line
do

	var$i=$line
	i=`expr $i + 1`

done < inputfile.txt
echo "==========================="
echo "creating the shell script"
echo "==========================="

echo "#!/bin/bash" > shellscript.sh
echo "#" >> shellscript.sh
echo "# Name: $var1" >> shellscript.sh
echo "# Task: $var1" >> shellscript.sh
echo "#" >> shellscript.sh
echo "#$ -N $var1"	>> shellscript.sh			
echo "#$ -e $var2/$var3.log"	>> shellscript.sh				
echo "#$ -o $var2/$var4.log"	>> shellscript.sh				
echo "#$ -pe threaded $var5"	>> shellscript.sh		
echo "#$ -l h_vmem=$var6"	>> shellscript.sh		
echo "" >> shellscript.sh
echo "LD_LIBRARY_PATH="/usr/lib64/" >> shellscript.sh
echo ""  >> shellscript.sh
echo "export LD_LIBRARY_PATH" >> shellscript.sh
echo ""  >> shellscript.sh
echo "cd $var2"	>> shellscript.sh		
echo ""   >> shellscript.sh
echo "mkdir $var2/$var7/"	>> shellscript.sh		
echo ""  >> shellscript.sh
echo "mkdir $var2/$var8/"  >> shellscript.sh			
echo ""  >> shellscript.sh
echo "mkdir $var2/$var7/$var9_vs_$var10"  >> shellscript.sh	
echo ""  >> shellscript.sh
echo "mkdir $var2/$var8/$var9_vs_$var10" >> shellscript.sh	
echo ""  >> shellscript.sh
echo "myprogram.sh -i $var11 -o $var2/$var7/$var9_vs_$var10 -$var5 $var2/$var9 -2 $var2/$var10" >> shellscript.sh   
echo ""  >> shellscript.sh
echo "cd $var2/$var8/$var9_vs_$var10"  >> shellscript.sh		
echo ""   >> shellscript.sh
echo "R CMD BATCH --no-save --no-restore "--args ref=\"mmu\" $var7DIR=\"$var2/$var7/$var9_vs_$var10\" outName=\"$var9_vs_$var10\" UCSCLink=\"http://test.com?id=$var11\"" myprogram2.sh >> shellscript.sh


you script that will be created is shellscript.sh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to make parameters optional?

Hi, I am trying to call a function inside a shell script. Is there a way in which I can make the parameters options in the call? Please help me with this. Thanks!!! (2 Replies)
Discussion started by: neeto
2 Replies

2. Shell Programming and Scripting

(Problem) Script with Parameters file

Hello, this is my first post, and.... obviusly, i have a problem, i have this script: #!/bin/sh . /tmp/variables ... ... DESTINATION=`hostname`_DESTINATION ... and the /tmp/variables has: #!/bin/sh aix53_DESTINATION="/temporal/`hostname`.mksysb.`date +\%d\%m\%y`" ** The problem is... (2 Replies)
Discussion started by: pelado
2 Replies

3. Shell Programming and Scripting

read parameters from file

Hi there, I'm wondering how I can run a script that would loop and launch a command that would take as parameter every line in a file one by one. For example, say I want to remove a list of files: ~$ cat filestoremove foo bar ~$ cat myscript for file in filestoremove; do rm $file... (2 Replies)
Discussion started by: chebarbudo
2 Replies

4. Shell Programming and Scripting

Read parameters from a file

Hello all, I need to extract parameters from a file. For example, I have a file file.dat as par1 val1 par2 val2 par3 val3 I need to extract this and store val1 in par1 variable and so on. Please help. Thanks for your support. (2 Replies)
Discussion started by: cheerful
2 Replies

5. Solaris

Which file is read by kernel to set its default system kernel parameters values?

Hi gurus Could anybody tell me which file is read by kernel to set its default system kernal parameters values in solaris. Here I am not taking about /etc/system file which is used to load kernal modules or to change any default system kernal parameter value Is it /dev/kmem file or something... (1 Reply)
Discussion started by: girish.batra
1 Replies

6. Shell Programming and Scripting

Calling sql file from shell script with parameters.

Hi, I am calling a sql file script.sql from shell script and passing few parameters also as shown below: sqlplus -S id/password @script.sql $param1 $param2 Now,In sql file I have to create a extract text file after querying oracle tables based on the parameters passed(param1,param2) as... (7 Replies)
Discussion started by: anil029
7 Replies

7. Shell Programming and Scripting

Loop to read parameters and stop

Hey guys, How do I make a loop that reads all the parameters en then stop when there are no parameters anymore ? Something that gives an output like this: ./Script.sh parameter1 parameter2 parameter3 parameter = parameter1 parameter = parameter2 parameter = parameter3 Thanks a lot,... (5 Replies)
Discussion started by: Miki1579
5 Replies

8. Shell Programming and Scripting

Shell Script to Dynamically Extract file content based on Parameters from a pdf file

Hi Guru's, I am new to shell scripting. I have a unique requirement: The system generates a single pdf(/tmp/ABC.pdf) file with Invoices for Multiple Customers, the format is something like this: Page1 >> Customer 1 >>Invoice1 + invoice 2 >> Page1 end Page2 >> Customer 2 >>Invoice 3 + Invoice 4... (3 Replies)
Discussion started by: DIps
3 Replies

9. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

10. UNIX for Beginners Questions & Answers

How to make a loop to read the input from a file part by part?

Hi All, We've a VDI infrastructure in AWS (AWS workspaces) and we're planning to automate the process of provisioning workspaces. Instead of going to GUI console, and launching workspaces by selecting individual users is little time consuming. Thus, I want to create them in bunches from AWS CLI... (6 Replies)
Discussion started by: arun_adm
6 Replies
dircmp(1)							   User Commands							 dircmp(1)

NAME
dircmp - directory comparison SYNOPSIS
dircmp [-ds] [-w n] dir1 dir2 DESCRIPTION
The dircmp command examines dir1 and dir2 and generates various tabulated information about the contents of the directories. Listings of files that are unique to each directory are generated for all the options. If no option is entered, a list is output indicating whether the file names common to both directories have the same contents. OPTIONS
The following options are supported: -d Compares the contents of files with the same name in both directories and output a list telling what must be changed in the two files to bring them into agreement. The list format is described in diff(1). -s Suppresses messages about identical files. -w n Changes the width of the output line to n characters. The default width is 72. OPERANDS
The following operands are supported: dir1 A path name of a directory to be compared. dir2 USAGE
See largefile(5) for the description of the behavior of dircmp when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of dircmp: LC_COLLATE, LC_CTYPE, LC_MES- SAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. (Differences in directory contents are not considered errors.) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWesu | +-----------------------------+-----------------------------+ SEE ALSO
cmp(1), diff(1), attributes(5), environ(5), largefile(5) SunOS 5.11 1 Feb 1995 dircmp(1)
All times are GMT -4. The time now is 02:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy