Thanks Olli, looking at your response make me realize I was trying to write
it so that it was easier to read for me on the output, which isn't what I
need to do. I used the loop to read the file and construct a single line
rather than worrying about multiple ones. Won't look pretty if I were
looking at the output, but to the computer it works just as well.

On Sun, Dec 21, 2014 at 6:57 PM, Olli Ries <[email protected]> wrote:
>
> On Sun, Dec 21, 2014 at 6:48 PM, Brian J. Rogers <[email protected]>
> wrote:
>
> > I know how to read a file using bash, but what I want to do is use each
> > line in the file as a dependency to be passed into another command, but I
> > want all the lines read in and structured as arguments for the other
> > command.
> >
> > I'm using Effing Package Management <https://github.com/jordansissel/fpm
> >
> > (FPM)
> > to test out building some RPMs before I go through the process of
> learning
> > to do it with Koji or something else. FPM has proven to be very simple
> for
> > me, which is why I'm using it. When executing it, it has a flag that
> > denotes a dependency and what version is required. It looks like this:
> >
> > -d "{dependency-package} >= {version}"
> >
> > I can have written as the package, version, and operator, so I don't have
> > to try to parse or do any special checks to construct the line. So I want
> > to be able to read each line, pre-pend '-d' then wrap it in quotes, then
> > append a slash to prevent it from executing. There is a parameter after
> all
> > the dependencies so, so I don't have to leave the last slash off. The
> whole
> > command would look like this:
> >
> > fpm -s dir -t rpm -n {package} -v {version} -C /path/to/{package}/output
> \
> >   -p {package}-VERSION.fc21.ARCH.rpm \
> >   -d "{dependency-package} >= {version}" \
> >   -d "{dependency-package} >= {version}" \
> >   usr
> >
> > Sorry if it's long winded or a little difficult to understand, I wasn't
> > sure how to phrase everything and hope it came out clear.
> >
> >
> I am not quite sure I understand what your input is, but the below snippet
> will let you read lines into $REPLY and will append to a string $result.
>
> It probably doesn't entirely do what you need but should be close enough.
> If not, pls share your input and we'll have you taken care off.
>
> -snip-
>
> result=""
>
> while read; do
>   result="${result}\n-d \"${reply}\""
> done < $INFILE
>
> echo $result
>
> -snap-
>
> hth
> O.
>
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
>

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to