Sponsored Content
Top Forums Shell Programming and Scripting Shell script to create runtime variables based on the number of parameters passed in the script Post 302974020 by pravin27 on Wednesday 25th of May 2016 03:00:53 AM
Old 05-25-2016
Code:
export Numbr_Parms=$#
export a=1
while [ $a -le $Numbr_Parms ]
do
eval export DBName_$a=\$$a
echo DBName_$a
eval echo \$$DBName_$a
a=`expr $a + 1`
done

This User Gave Thanks to pravin27 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Number of parameters to a shell script

Is there any restriction on number of parameters can be passed on to the shell script? I found, after 9th parameter for parameter 10, it is taking parameter 1. (1 Reply)
Discussion started by: videsh77
1 Replies

2. Shell Programming and Scripting

Problem with script not able to take parameters passed to it

when I pass any 2 parameters it always says: Number of parameters passed: 1 and the job_name as x Can some body help? (7 Replies)
Discussion started by: dsravan
7 Replies

3. Shell Programming and Scripting

Problem with script not able to take parameters passed to it

debug output: (3 Replies)
Discussion started by: dsravan
3 Replies

4. UNIX for Dummies Questions & Answers

ksh: verifying number of parameters passed

hi all, i have a ksh script that takes up to 3 parameters -- only 2 of which are required. what's the simplest way to check if the user passed 2 or 3 parameters? if 3 parameters are not null then do this elif 2 parameters are not null then do this else echo "you need at least 2... (5 Replies)
Discussion started by: ankimo
5 Replies

5. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

6. Shell Programming and Scripting

Dynamic SQL query based on shell script parameters

Hi, I need a script that will run a dynamic Oracle SQL. Dynamic meaning the SQL statement depends on the parameter. For instance, something like this: #!/bin/ksh -x # Set environment . /home/mine/set_vars sqlplus $LOGINID <<! >> /home/mine/log.txt select count(1) from $1 where... (2 Replies)
Discussion started by: laiko
2 Replies

7. UNIX for Dummies Questions & Answers

Create a shell script for write files with 2 parameters

Hello, I'm a newbie in shell script. So, i would like to create a shell script which take 2 IN parameters (PARAM1 and PARAM2). This script need to create 2 files as : I need to create this file /etc/apache2/sites-available/PARAM2 : <VirtualHost *:80> DocumentRoot "/home/PARAM1/www"... (0 Replies)
Discussion started by: chatlumo
0 Replies

8. Programming

create a spool file based on values passed from korn shell to sql script

this is my issue. 4 parameters are passed from korn shell to sql script. parameter_1= varchar2 datatype or no value entered my user. parameter_2= number datatype or no value entered my user. parameter_3= number datatype or no value entered my user. parameter_4= number datatype or no... (5 Replies)
Discussion started by: megha2525
5 Replies

9. Shell Programming and Scripting

Three parameters passed from a script to other at different time

nothing (0 Replies)
Discussion started by: shikha84
0 Replies

10. Shell Programming and Scripting

Getting number of argument passed to a shell script

Hi Experts, I have been trying to work on a simple shell script that will just add the two argument passed to it. Here is what i tried : #!/bin/bash welcome(){ echo "Welcome to this Progg. which will accept two parameter" } main_logic(){ arg=$# echo "Number of argument passed is... (4 Replies)
Discussion started by: mukulverma2408
4 Replies
ENVSTORE(1)						    BSD General Commands Manual 					       ENVSTORE(1)

NAME
envstore -- save and restore environment variables SYNOPSIS
envstore command [args ...] DESCRIPTION
envstore can save and restore environment variables, thus transferring them between different shells. command must be one of clear Forget all stored variables eval Produce shell code for evaluation, restoring all saved variables list List saved variables in better readable format save variable [value] Save variable either with its current shell value or with value rm variable Remove variable from store Note: Only the first character of command is checked, so envstore e instead of envstore eval, envstore c for envstore clear, etc., are also valid. ENVIRONMENT
ENVSTORE_FILE The file in which the environment parameters are stored, /tmp/envstore-EUID by default, LIMITATIONS
Variable names or values must not contain null bytes or newlines. Due to limitations imposed by most shells, it is not possible to save parameters containing more than one consecutive whitespace. envstore will save and display them correctly, but unless you do IFS trickery, your shell will not be able to load them. The current maximum length (in bytes) is 255 bytes for the variable name and 1023 bytes for its content. AUTHOR
envstore was written by Daniel Friesel <derf@derf.homelinux.org>. Original idea and script by Maximilian Gass <mxey@ghosthacking.net>. SEE ALSO
envify(1) BSD
December 1, 2009 BSD
All times are GMT -4. The time now is 10:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy