Ah, that does it, thanks Patrick. I do have a newer version of Zsh from Homebrew so my instinct was to look there first. The part about $1 is mostly UNIX habit from dealing with other things (which are not filters) that need to be able to get the contents without explicitly passing in a filename, which defeats the purpose.
On Tuesday, January 12, 2021 at 11:05:32 AM UTC-5 Patrick Woolsey wrote: > On 1/12/21 at 10:22 AM, [email protected] (Christopher > Finazzo) wrote: > > >I am redoing a filter which sorts a list of items. Although > >which zsh tells me the location of the executable is at > >/usr/local/bin/zsh, BBEdit says there is nothing on STDIN when > >I run this against a document. > > > >#!/usr/local/bin/zsh > > > >sort "$1" | uniq | sort -nr | bbedit > > > >Should this be in /usr/bin? Somehow this hasn't come up with > >the other filters I've used - mostly in other languages so I > >haven't had to fix them in this way before. > > > The default (OS-provided) zsh is '/bin/zsh' so perhaps you've > installed another version via Homebrew (or similar). > > Also, a couple points about your filter: > > Since BBEdit sends the contents of the frontmost document (or > selection) to the filter on STDIN and 'sort' will accept data on > STDIN, the "$1" is superfluous. > > Likewise, since BBEdit expects the filter to provide output on > STDOUT, there's no need to pipe to the 'bbedit' tool, so please > try this: > > ======== > #!/bin/zsh > sort | uniq | sort -nr > ======== > > > Regards > > Patrick Woolsey > == > Bare Bones Software, Inc. <https://www.barebones.com/> > > -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/ccad7ca1-c3d8-4869-b13d-c2256cc563d1n%40googlegroups.com.
