Sponsored Content
Top Forums Shell Programming and Scripting Creating a config file with specified parameters Post 303025509 by bakunin on Sunday 4th of November 2018 02:55:10 PM
Old 11-04-2018
Quote:
Originally Posted by multiverse22
I want to create a config file that has parameters that can be specified using - or -- (without an equals sign), as well as the ability to output the file using - or --. Could somebody point me to a generic script to do this?
You might want to investigate getopts to parse the command line, which will do a lot of the "cooking" already (tokenizing by word splitting, for instance). It will, nevertheless, restrict you to a predefined set of options you can pass this way. You can predefine it yourself but then you will have to stick with it (unless you chang the script). So the question is: is that sufficient for your purposes or not?

If it is, you might want to acquaint yourself with getopts first and then ask specific questions if you still need help. If this is not sufficient for your purpose, then i suppose you are on your own and i wouldn't know of any "generic" script you could use. You should perhaps start by deciding what your config files should look like:

- do you want to allow commentaries like this:
Code:
alpha = 1
# this is a line to be ignored
beta = 2

- do you want to allow inline commentaries like this:
Code:
alpha = 1     # this is a comment
beta = 2      # this is another comment

It is easy to dismiss such comments as unnecessary and complicating things but when you have longer complex configs you might want to have some comments explaining inplace why something is what it is and what were your reasons to put it there.

- will you need "chapters" in these config files, like in the Windows init-files-style:
Code:
[part1]
alpha =  1
beta = 2

[part2]
gamma = 3
delta = 4

and perhaps many more questions. You should, before trying to write a script, first define E-X-A-C-T-L-Y how the files you want to produce should look like. Decisions like this will not be easily corrected once you start programming and may well mean that you throw away a script that is already "almost" working and start anew.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extracting data from text file based on configuration set in config file

Hi , a:) i have configuration file with pattren <Range start no>,<Range end no>,<type of records to be extracted from the data file>,<name of the file to store output> eg: myfile.confg 9899000000,9899999999,DATA,b.dat 9899000000,9899999999,SMS,a.dat b:) Stucture of my data file is... (3 Replies)
Discussion started by: suparnbector
3 Replies

2. Shell Programming and Scripting

Generate PARAMETERS from config file

Hi, I have a config file like below: config.cfg ========== PARAm_1_MIN=20 PARAM_1_MAX=40 PARAM_2_MIN=3 PARAM_2_MAX=40 PARAM_3_MIN=0 PARAM_3_MAX=4.5 ..... ... ... (1 Reply)
Discussion started by: sachin4sachi
1 Replies

3. AIX

tuning network parameters : parameters not persist after reboot

Hello, On Aix 5.2, we changed the parameters tcp_keepinit, tcp_keepintvl and tcp_keepidle with the no command. tunrestore -R is present in inittab in the directory /etc/tunables we can clearly see the inclusion of parameters during reboot, including the file lastboot.log ... (0 Replies)
Discussion started by: dantares
0 Replies

4. Shell Programming and Scripting

parsing config file to create new config files

Hi, I want to use a config file as the base file and parse over the values of country and city parameters in the config file and generate separate config files as explained below. I will be using the config file as mentioned below: (config.txt) country:a,b city:1,2 type:b1... (1 Reply)
Discussion started by: clazzic
1 Replies

5. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

6. Shell Programming and Scripting

help with creating a suitable config file

Hi, currently, my shell script hard codes several array variables (etc. PEOPLE=( Vincar Matthew ) FRUITS=( Banana Apple Orange Pineapple ) I want to move these information into one config file and then in my shell script, parse the config file into the appropriate variables. Do... (13 Replies)
Discussion started by: kaoboy97
13 Replies

7. UNIX for Advanced & Expert Users

parameters file

Hi, on AIX 6.1 I have a shell script that calls another shell which have some parameters. Say like the following : ##This is main script############ myparameters.sh command1 command2 ..... .... And here myparameteres.sh : export ORACLE_SID=MYDB export... (6 Replies)
Discussion started by: big123456
6 Replies

8. Shell Programming and Scripting

Run a program-print parameters to output file-replace op file contents with max 4th col

Hi Friends, This is the only solution to my task. So, any help is highly appreciated. I have a file cat input1.bed chr1 100 200 abc chr1 120 300 def chr1 145 226 ghi chr2 567 600 unix Now, I have another file by name input2.bed (This file is a binary file not readable by the... (7 Replies)
Discussion started by: jacobs.smith
7 Replies

9. Red Hat

Apache virtual host config vs global config problem

Hi folks, I am trying to configure Apache webserver and also a virtual host inside this webserver. For Global server config: /var/www/html/index.html For virtual host config: /var/www/virtual/index.html Both client10 & www10 are pointing to 192.168.122.10 IP address. BUT, MY... (1 Reply)
Discussion started by: freebird8z
1 Replies

10. 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
zlarfgp.f(3)							      LAPACK							      zlarfgp.f(3)

NAME
zlarfgp.f - SYNOPSIS
Functions/Subroutines subroutine zlarfgp (N, ALPHA, X, INCX, TAU) ZLARFGP generates an elementary reflector (Householder matrix) with non-negatibe beta. Function/Subroutine Documentation subroutine zlarfgp (integerN, complex*16ALPHA, complex*16, dimension( * )X, integerINCX, complex*16TAU) ZLARFGP generates an elementary reflector (Householder matrix) with non-negatibe beta. Purpose: ZLARFGP generates a complex elementary reflector H of order n, such that H**H * ( alpha ) = ( beta ), H**H * H = I. ( x ) ( 0 ) where alpha and beta are scalars, beta is real and non-negative, and x is an (n-1)-element complex vector. H is represented in the form H = I - tau * ( 1 ) * ( 1 v**H ) , ( v ) where tau is a complex scalar and v is a complex (n-1)-element vector. Note that H is not hermitian. If the elements of x are all zero and alpha is real, then tau = 0 and H is taken to be the unit matrix. Parameters: N N is INTEGER The order of the elementary reflector. ALPHA ALPHA is COMPLEX*16 On entry, the value alpha. On exit, it is overwritten with the value beta. X X is COMPLEX*16 array, dimension (1+(N-2)*abs(INCX)) On entry, the vector x. On exit, it is overwritten with the vector v. INCX INCX is INTEGER The increment between elements of X. INCX > 0. TAU TAU is COMPLEX*16 The value tau. Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: September 2012 Definition at line 105 of file zlarfgp.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.2 Tue Sep 25 2012 zlarfgp.f(3)
All times are GMT -4. The time now is 04:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy