[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: Ash eval wierdness
From: Harald Becker <ralda () gmx ! de>
Date: 2011-05-25 18:00:13
Message-ID: 4DDD43AD.7010308 () gmx ! de
[Download RAW message or body]
Hallo Bob!
> eval $(sed -n -e 's/=\(.*\)/="\1"/p' < file)
Why do you redirect the input file here?
eval $( sed -n -e 's/=\(.*\)/="\1"/p' file )
... shall do the job.
In addition it is possible to strip of spaces around = (if required):
eval $( sed -n -e 's/ *= *\(.*\)/="\1"/p' file )
With some more tricky sed scripts you can even suppress comments in the
file, select only specific variables for usage and more, e.g.
eval $( sed -n \
-e '/^$/d' \
-e '/^#/d' \
-e 's/^\([a-z_]+\) *= *\(.*\)/\1="\2"/' \
-e '/^abc=/p' \
-e '/^xyz=/p' \
file )
... just to give some examples.
--
Harald
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic