Get path to $SHELL for a Text Filter

22 views
Skip to first unread message

Christopher Finazzo

unread,
Jan 12, 2021, 10:22:40 AM1/12/21
to BBEdit Talk
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.

Patrick Woolsey

unread,
Jan 12, 2021, 11:05:32 AM1/12/21
to bbe...@googlegroups.com
On 1/12/21 at 10:22 AM, chris....@gmail.com (Christopher
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/>

Christopher Finazzo

unread,
Jan 12, 2021, 11:38:12 AM1/12/21
to BBEdit Talk
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.
Reply all
Reply to author
Forward
0 new messages