bash script config file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting bash script config file
# 1  
Old 12-29-2011
bash script config file

hi all

config.sh :

Code:
dhcp="0"
setip="1"
telnet="1"
ping="1"


main.sh

Code:
function dhcp {

}

function setip {

}

function telnet {

}

.........


I have a question, If the variable is 1 in the config file,how to call it function name, variable is not set or "0" not call function.

thanks all

Last edited by radoulov; 12-29-2011 at 06:41 PM.. Reason: Code tags!
# 2  
Old 12-29-2011
[ "$dhcp" -gt 0 ] && dhcp
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Pass config file to bash script

I just want to make sure I am understanding how to pass a config file to a bash script . In the below I pass to arguments to a script, then define them in the script as id and config. I then source config using ., if I understand correctly the variables in the config file can now be used by the... (11 Replies)
Discussion started by: cmccabe
11 Replies

2. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies

3. Shell Programming and Scripting

parsing a config file using bash

Hi , I have a config _file that has 3 columns (Id Name Value ) with many rows . In my bash script i want to be able to parse the file and do a mapping of any Id value so if i have Id of say brand1 then i can use the name (server5X) and Value (CCCC) and so on ... Id Name ... (2 Replies)
Discussion started by: nano2
2 Replies

4. Shell Programming and Scripting

Bash parameter expansion from a config file

Hi - I am trying to do a simple config file with known variable names in it, e.g.: contents of config file a.conf: -a -b $work -c $host simplified contents of bash script file: work='trunk' host='alaska' opts=$(tr '\n' ' ' < a.conf) opts="$opts $*" mycommand $opts arg1 arg2 The... (3 Replies)
Discussion started by: mrengert
3 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

Calling Config file in the Script.. Please help

Hi Guys, I need some help related to my script... I will explain you briefly about my script and requirement I written one script which will monitor all my services in the server and send a mail to me.... There are about 10 Services(Processes) running on my services, and I have written 10... (1 Reply)
Discussion started by: Anji
1 Replies

7. Shell Programming and Scripting

need help with calling a config file in script

Hi, I am writting a script and i am using SYBASE database. i have a config file with my logging credentials. when i am calling the file via isql command its throwing me an error. see the below code. while read line do SERVER=`echo $linea |awk -F"|" ' {print $1} ' ` ... (6 Replies)
Discussion started by: dazdseg
6 Replies

8. 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

9. Web Development

bash script editing my apache config files

okay i'm going to try to say this uber-simple: I use dropbox (file-sync service). in order for dropbox sync files, they must be its children eg. somewhere under /home/jzacsh/Dropbox]. I want to now use it to keep my development files in sync across my machines: easy: just move my dev. files... (2 Replies)
Discussion started by: jzacsh
2 Replies

10. Solaris

bash and its config file

Guys im using bash and for me i think its the best shell, anyway which conf file related to bash ? is it $SHELL or .profile i want to add path to it so i dont need to type the full path of the binary file, i also want to configure the behaviour of the shell, please help. (1 Reply)
Discussion started by: XP_2600
1 Replies
Login or Register to Ask a Question