On Thursday, November 12, 2015 at 11:26:33 AM UTC-5, Christopher Stone
wrote:
>
> PATH=/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
>
>
> Not necessary for normal usr commands.
>
I know it shouldn't be, but I've gotten bitten by that in the past with
some apps (Hazel and Keyboard Maestro) which don't always seem to get the
$PATH I want, so I just got in the habit of declaring it. Actually I use
this:
if [ -e "$HOME/.path" ]
then
source "$HOME/.path"
else
PATH=/usr/local/scripts:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
fi
> #!/bin/zsh
>
> read -r -d '' bbeditScript <<'EOF'
> tell application "BBEdit"
> tell front document
> if on disk = true then
> tell it to save
> end if
> end tell
> end tell
> EOF
>
> sed -E 's![[:blank:]]+$!!';
> osascript -e "$bbeditScript" &|
>
>
That worked great, and the `sed` command is much more compact.
> The only downside seems to be that the cursor/insertion point moves when
> it runs. I don't know how to avoid that. IF anyone else does, or has a
> better way of doing this, please let me know.
>
>
> Look at the environment variables on p. 318 of the BBEdit user manual.
>
> You can discover a number of things about the selection and restore it
> using the same AppleScript you save the document with.
>
Thanks. I never really learned AppleScript beyond the “Go check Google”
stage. Will check out the manual though…
>
> Or you can go pure AppleScript which will not affect the selection.
>
> *tell* *application* "BBEdit"
> *tell* *front* *text document*
> *tell* *its* *text* *to* *replace* "[[:blank:]]+$" using "" options
> {search
> mode:*grep*, starting at top:*true*}
> *if* *its* on disk = *true* *then* *save* *it*
> *end* *tell*
> *end* *tell*
>
>
>
Whenever I used that, the trailing spaces were removed, but the document
ended up unsaved… and empty. Not sure why.
--
This is the BBEdit Talk public discussion group. If you have a
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.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 post to this group, send email to [email protected].