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
echo(3XCURSES)						  X/Open Curses Library Functions					    echo(3XCURSES)

NAME
echo, noecho - enable/disable terminal echo SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib -R /usr/xpg4/lib -lcurses [ library... ] c89 [ flag... ] file... -lcurses [ library... ] #include <curses.h> int echo(void); int noecho(void); DESCRIPTION
The echo() function enables Echo mode for the current screen. The noecho() function disables Echo mode for the current screen. Initially, curses software echo mode is enabled and hardware echo mode of the tty driver is disabled. The echo() and noecho() functions control soft- ware echo only. Hardware echo must remain disabled for the duration of the application, else the behavior is undefined. RETURN VALUES
Upon successful completion, these functions return OK. Otherwise, they return ERR. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
getch(3XCURSES), getstr(3XCURSES), initscr(3XCURSES), libcurses(3XCURSES), scanw(3XCURSES), attributes(5), standards(5) SunOS 5.11 5 Jun 2002 echo(3XCURSES)
All times are GMT -4. The time now is 07:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy