Sponsored Content
Top Forums Shell Programming and Scripting Running a script with multiple variables like 25 variables. Post 302862677 by Lakshman_Gupta on Friday 11th of October 2013 08:58:24 AM
Old 10-11-2013
Running a script with multiple variables like 25 variables.

Hi All,

i have a requirement where i have to run a script with at least 25 arguements and position of arguements can also change. the unapropriate way is like below. can we achieve this in more good and precise way??

Code:
#!/bin/ksh
##script is sample.ksh

age=$1
gender=$2
class=$3
.
.
.
.
.
.
.
title=$25

so while running scripts i have to give like below.

Code:
./sample.ksh a13 gM c4 .... tMs

now problem is that position of these arguments can change while passing to script
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pass multiple variables to SQL script

I am trying to close of multiple users in an Oracle database. Each users has records in multiple tables what I need to do is use a script that call each SQL seperately passing either CLI arguments or gathered arguments from the users during run time. ## Accept variable(s) from the command line... (1 Reply)
Discussion started by: jagannatha
1 Replies

2. Shell Programming and Scripting

Variables are not getting exported while running the script in cronjob

Hi All Some how, variables are not getting exported while running the script in cronjob. Variable value is coming blank. But the variables are geting the value when the same script I am running manually. Any idea why? When running the script in cron-job ==================================... (7 Replies)
Discussion started by: csaha
7 Replies

3. UNIX Desktop Questions & Answers

trying to create a script with multiple variables...

I have created a script that prompts the user to enter three variables that are seperated by a space as the delimiter. It then performs a command 3 seperate times for each variable entered. I want the script to llow the user to enter as many variables as they may like and the script to... (5 Replies)
Discussion started by: Italy87
5 Replies

4. Shell Programming and Scripting

problem accessing Multiple Variables from C Program to a Shell script

program name--test #!/bin/bash output1=`/home/user/a.c` output2=`/home/user/a.c` k=`$output1 + 1` m=`$output2 + 1` echo $k echo $m --------------------------------------------------------------------------- prgram name--a.c #include<stdio.h> int main() (1 Reply)
Discussion started by: sameworld1980
1 Replies

5. Shell Programming and Scripting

sql output from multiple rows and columns as variables in a script

This is for an Oracle journal import. I was using a pl/sql package and oracle API's. Oracle added invoker rights to their API's and now my package won't run. I didn't want to use their API's anyway. The only reason i was using pl/sql and the API's (just a package) was to utilize a cursor. How... (2 Replies)
Discussion started by: lmu
2 Replies

6. Shell Programming and Scripting

Multiple Variables for BASH script

Hello, I am new to the whole "scripting" thing. Below is the script that I have so far and where i need the Variables to go (VAR#) #!/bin/bash #Sample Script VAR1= echo "Choose an option: 1) Create a file. 2) Delete a file. 3) Move a file." read VAR1 case $VAR1 in 1) echo "Pick... (4 Replies)
Discussion started by: eclerget
4 Replies

7. Shell Programming and Scripting

awk (or other) script that assigns fields from a line to multiple variables

Hey all, Unfortunately I have only basic knowledge of awk and/or scripting. If I have a file with lines that can look similar to this: Name=line1 Arg1=valueA Arg2=valueB Arg3=valueC Name=line2 Arg1=valueD Name=line3 Arg1=valueE Arg3=valueF Name=line4 Arg2=valueG ... (4 Replies)
Discussion started by: Rike255
4 Replies

8. Shell Programming and Scripting

Using a script to define variables and run multiple other scripts in succession.

I'm pretty new to scripting in Korn shell so please forgive me... What I'm trying to do is to create a script that calls multiple other ksh scripts and defines variables for text files. I need it to define my user defined variables (file paths, date & time stamps, etc that are currently in... (1 Reply)
Discussion started by: bluejwxn8
1 Replies

9. Linux

How to store count of multiple queries in variables in a shell script?

how to store the count of queries in variables inside a filein shell script my output : filename ------- variable1=result from 1st query variable2=result from 2nd query . . . . (3 Replies)
Discussion started by: sanvel
3 Replies

10. Shell Programming and Scripting

Assigning multiple variables in ksh script

Is it possible to have a user input multiple words in one line and have the script assign each word a variable? I'm stuck please assist. Example using "BILL JOHN SARA JILL" as what the user could type: printf "Enter account names: " BILL JOHN SARA JILL read input (9 Replies)
Discussion started by: seekryts15
9 Replies
POWERD(8)						      System Manager's Manual							 POWERD(8)

NAME
powerd - UPS monitoring daemon SYNOPSIS
/sbin/powerd [tty] DESCRIPTION
powerd monitors the serial port connected to an UPS device and will perform an unattended shutdown of the system if the UPS is on battery longer than a specified number of minutes. powerd needs to watch a tty with modem control properties. Please refer to the powerd documen- tation for further information. powerd also has the capabilities of notifying other clients on the network that may have a UPS but not be connected to the serial line that there is a power outage, and id configured through the powerd.conf file CONFIGURATION FILE
Here is the configuration format: Lines beginning with '#' are ignored. MODE <mode> specifies the mode the UPS should be in. Valid arguements are MONITOR and PEER MONITOR being the mode to actually watch a UPS serial port, and PEER being to listen for a connection from a machine in MONITOR mode MONITOR <device> Specifies which device to monitor while in MONITOR mode. Specify an actual device file. Example: /dev/ttyS0 POWERFAIL <line> <high|low> Specifies which lines on the serial ports indicate that the power is out. Valid arguements are DCD, CAR, CTS, and RNG. Also specify if the line being HIGH or LOW indicates a power failure. Since most people may not know this arguement, Please use the enclosed upsdetect program to automatically find this line. NOTIFY <hostname[:port]> <password> Specified in MONITOR mode to notify a client running in PEER mode. Specify the hostname of the machine, and optional port the daemon is running on, And the password as specified by their LISTEN command. See below for more details. LISTEN <hostname> <password> Specified in PEER mode, specifies a hostname that is allowed to notify us of when the power is out, and the password they shall give us to authenticate themselves. The 2 passwords should match on the MONITOR mode machines NOTIFY password, and the PEER modes LISTEN password. LISTENPORT <port> Specified in PEER mode, specifies the port that powerd should listen on. If you use this arguement, powerd shall not default to using port 532, and the machine in MONITOR mode must specify the port you use in their NOTIFY command. DELAY <delayinseconds> Specifies how many seconds before notifying init of a power outage. Note that this doesnt mean that the system will shut down in that many seconds, as it depends on how init is configured. Init usually issues a 2 min shutdown. USER <username> Specifies which username to drop to from root. The program will reobtain root access only when it needs to, Like when notifying init that the power is out. This is simply a security feature, and not needed for powerd to operate. Note: powerd must still be run ini- tially as root. It will then drop to the user if, and only if, a username is specified. ARGUMENTS
None: Please use the configuration file /etc/powerd.conf which can be generated with detectups. See detectups(8) for more information FILES
/etc/powerd.conf powerd configuration file /etc/powerstatus indicates line power status /etc/inittab init is what actually issues the shutdown SEE ALSO
powerd(8), shutdown(8), wall(1), init(8), inittab(5). AUTHOR
James Brents <James@nistix.com> (with parts of this man page borrowed from all over the Linux community) POWERD(8)
All times are GMT -4. The time now is 01:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy