Thread: Parsing for configfile not working
edit: why no-one replying?
having trouble creating parser configuration file format created in bedroom. maybe reinventing wheel, hey, @ least have created possibly created config format..
here (debugging) parser far:
filegoeshere.rc:code:#!/bin/bash ifs=" " while read optname option ; eval $optname=$option if [ $optname != program ] ; echo "setting $optname $(echo $option | tr -d \")" fi done < filegoeshere.rc
attempts use memory outputs (didn't exist):code:program "test file" message0001 "hello everyone." message0002 "blah, blah, blah..." opt1 "yes" opt2 "no"
the problem lies in setting optname variable option.code:jack@radio-player:~/desktop$ ./confparser.sh /home/jack/.themes/seriousshiki-attmp2/gtk-2.0/panel.rc:9: unable locate image file in pixmap_path: "./panel/panel-bg.png" setting message0001 hello everyone. setting message0002 blah, blah, blah... setting opt1 yes setting opt2 no jack@radio-player:~/desktop$ echo -e "$message0001\n$message0002" jack@radio-player:~/desktop$ echo -e "$message0001 $message0002" jack@radio-player:~/desktop$ echo "$message0001 $message0002" jack@radio-player:~/desktop$ ./confparser.sh setting message0001 hello everyone. setting message0002 blah, blah, blah... setting opt1 yes setting opt2 no jack@radio-player:~/desktop$ ./confparser.sh usage: file [-bchiklnnprsvz0] [--apple] [--mime-encoding] [--mime-type] [-e testname] [-f separator] [-f namefile] [-m magicfiles] file ... file -c [-m magicfiles] file [--help] ./confparser.sh: line 4: everyone.: command not found setting message0001 hello everyone. ./confparser.sh: line 4: blah,: command not found setting message0002 blah, blah, blah... setting opt1 yes setting opt2 no jack@radio-player:~/desktop$ ./confparser.sh setting message0001 hello everyone. setting message0002 blah, blah, blah... setting opt1 yes setting opt2 no jack@radio-player:~/desktop$ ./confparser.sh setting message0001 hello everyone. setting message0002 blah, blah, blah... setting opt1 yes setting opt2 no jack@radio-player:~/desktop$ ./confparser.sh setting message0001 hello everyone. setting message0002 blah, blah, blah... setting opt1 yes setting opt2 no jack@radio-player:~/desktop$ echo $opt1 jack@radio-player:~/desktop$
create parser based on 1 following things:
- tells option name , it's value
- sets option name, variable, option value
- preferably uses function may embedded in other bash programs
language of echo prompt may any, must output config file's option names , values, , must put them in terminal's memory.
helpful writer program this.
cannot complicated (i.e. must use commands found on base debian installation , nothing more) because test system me debian squeeze extras, e.g. compiz , non-free firmware microcode.![]()
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help Parsing for configfile not working
Ubuntu
Comments
Post a Comment