On 12Jan2012 19:07, Dean S. Messing <de...@sharplabs.com> wrote:
| On 13 Jan 2012 at 13:55:27, Cameron Simpson wrote:
| <snip>
| > The:
| > 
| >   <foo command [args...]
| > 
| > form is handy for programmatically constructed pipelines, too.
| 
| Sorry, I don't understand "programmatically constructed pipelines".
| Would you elaborate?  Thanks

Where one has a script that figures out a pipeline and assembles it.
So one might have a file conversion tool that goes:

  my-convert-script src-file dst-file change1 change2 change3 ...

which goes:

  src=$1; shift
  dst=$2; shift

  shcmd="<\"\$src\" cat"
  for change
  do
    case "$change" in
      a)        conv="cmd-to-do-change-a" ;;
      b)        conv="some-other-command-to-do-change-b" ;;
    esac
    shcmd="$shcmd | $conv"
  done
  shcmd="$shcmd >\"\$dst\""

  sh -c "$shcmd"

This builds a shell pipeline command, starting with the input
redirection, adding pipes to munge the data, then adding the output
redirection. (Obviously there's no error checking etc above, and the
"cat" can be optimised out, etc.)

Cheers,
-- 
Cameron Simpson <c...@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

And it is not our part here to take thought only for a season, or for a few
lives of Men, or for a passing age of the world.        - Gandalf the grey
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Reply via email to