Yup, this is exactly how I use it on my Linux systems.  I have a bash
function that exists in my .bashrc that ssh's back to my mac and starts
bbedit with a commandline to open the relevant file via sftp.

Here's the snipit from by .bashrc:

export REMOTEHOST=`echo $SSH_CLIENT | cut -d ' ' -f 1`
export HOSTIP=`echo $SSH_CONNECTION | cut -d ' ' -f 3`

function bbedit {

# bbedit won't open a remote file via sftp if it doesn't exist. So, if it's
a new file
# create it, call bbedit to open, and then kill it.
FCREATED=0
if [ ! -e "$PWD/$1" ]
then
touch "$PWD/$1"
FCREATED=1
fi
ssh derosier@$REMOTEHOST /usr/local/bin/bbedit -c -u --front-window
"sftp://$USER@$HOSTIP/$PWD/$1";
# The above call will background and return immediately. The file will open
in bbedit
# but since we've created it, and we don't want to leave it around, we kill
it right away.
# If the user saves it, it gets recreated and content is saved. If not,
there's no file,
# so we're cool too. It's a bit odd, but it works.
if [ "$FCREATED" -eq "1" ]
then
rm "$PWD/$1"
fi
}


The really important part is the ssh line.  The rest is just to
create/clear new files.  If you do `bbedit .` it will open an sftp browser
in that directory, and if you do `bbedit filename` it will open that file.

The other important thing to note is I have my .ssh/config file set to
always use IPv4 on these hosts.  I'm sure I could fix it but IPv6 screws it
up and I haven't bothered to figure out why.

Additionally, I have bbedit used as my CSCOPE_EDITOR.  This can't use
functions, so I have a little script, ~/bin/bbeditcscope that contains this
one line:

ssh derosier@$REMOTEHOST /usr/local/bin/bbedit --front-window $1
"sftp://$USER@$HOSTIP/$PWD/$2";


Note that this really only works properly with current versions of BBEdit
as they recently fixed a bug for me (talk about good customer service) that
relates to the line number syntax.

I hope that helps,
- Steve


On Wed, Jul 11, 2018 at 4:41 PM Rick Gordon <li...@rickgordon.com> wrote:

> Is there any way that a bbedit command could be built to run in Terminal
> on a remote system? I realize that it would have to be a different
> creature, since that system would have no knowledge of BBEdit.
>
> But I wondered about something like a command which might cause a file
> to be delivered to the Mac via scp in to a watch folder on the Mac that
> BBEdit could monitor, open, edit, and return the edited file to the host
> system, with a result similar to opening a remote file via SSH on the Mac.
>
> The end result would be an executable that could be stored on the host
> system and run similar to the basic syntax for the command-line
> executable as used on the Mac, such as:
>
> bbedit path-to-file
>
> Does that even make any sense, in term of logistics?
>
> ___________________________________________
> RICK GORDON
> EMERALD VALLEY GRAPHICS AND CONSULTING
> ___________________________________________
> WWW: http://www.shelterpub.com
>
> --
> This is the BBEdit Talk public discussion group. If you have a
> feature request or would like to report a problem, please email
> "supp...@barebones.com" 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 bbedit+unsubscr...@googlegroups.com.
> To post to this group, send email to bbedit@googlegroups.com.
> Visit this group at https://groups.google.com/group/bbedit.
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" 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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to