[svlug] bash scripts - config files with comments?

Michael Cheselka cheselka at gmail.com
Sun Aug 19 23:24:53 PDT 2007


Hello,

He's trying to source the file - like an include.

Something like:

[ryoohki at ryoohki ~]$ cat -vte source_me.sh
# blah blah$
 # blah blah$
$(( 1 + 1 )) # balh blah$
sourceme=test # blah blah$
date # blah blah$
#date$
date # blah blah$
[ryoohki at ryoohki ~]$ . source_me.sh
bash: 2: command not found
Sun Aug 19 23:18:16 PDT 2007
Sun Aug 19 23:18:16 PDT 2007
[ryoohki at ryoohki ~]$ echo $sourceme
test
[ryoohki at ryoohki ~]$

Comments are automatically excluded.  No effort required.
What is happening when you source the file?

Mike

On 8/18/07, Robert Citek <robert.citek at gmail.com> wrote:
> On 08/18/2007 02:14 AM, Florin Andrei wrote:
> > Robert Citek wrote:
> >> Avoiding sed:
> >>
> >> while read LINE; do
> >>    LINE=${LINE%%#*}
> >>    [ -z "$LINE" ] && continue
> >>    : do what you want here
> >> done < config-file
> >
> > Looks like it's exactly what I was looking for. Thanks!
> >
> > Now let me test it a little bit...
>
> Hope it works for you.  Please let us know how it goes.
>
> Regards,
> - Robert
>
>
> _______________________________________________
> svlug mailing list
> svlug at lists.svlug.org
> http://lists.svlug.org/lists/listinfo/svlug
>


-- 
When in the Potemkin Wired be a Potemkin Lain.



More information about the svlug mailing list