4 ms·
"oh no i reinstalled the os on my vps and now ssh has it on good authority (said authority is line 68) that someone is doing something nasty" ed .ssh/config
by 0x69420 4y ago
"oh no i reinstalled the os on my vps and now ssh has it on good authority (said authority is line 68) that someone is doing something nasty"
ed .ssh/config
68d
wq
done, didnt fill my terminal with vim or emacs, didnt tab over to my gui editor then back again
also it's a nicely "semantic"/compact/comprehensible way of expressing patches in things like portfiles or nix expressions:
postPatch = ''
ed Makefile <<EOF
/^CFLAGS/s/-DFOO//
/-funroll-loops/s//-ffast-math/
/_BSD_SOURCE/s//_DEFAULT_SOURCE/
/^LDFLAGS/d
/ranlib/s,,${pkgs.my_special_epic_ranlib}/bin/ranlib,
wq
EOF
'';
etc etc
sure, using ed as your daily driver code editor in 2022 is probably stupid, but it's still useful enough that any linux distro that excludes it by default irritates me
- bitwize 4y agoNow that Visual Studio Code has remote edit, you can do all that in a nice, modern way :)
- w0m 4y agoRemote Edit requires installing a node server to connect to. That would crash my router.
- fmakunbound 4y ago> ed .ssh/config I think this is my ed use-case as well. I've noticed I need to "apt-get install ed" sometimes. The standard editor is not always standard, it seems.
- 0x69420 4y agoyeah, unfortunately, despite literally being specified in posix (hell, macos bundles it) one of these days i will go around pestering distro release engineers to include it; after all, it's less heavyweight than any one of their homespun lightdm greeters
- mananaysiempre 4y agoThe set of utilities specified in POSIX is, erm, not entirely sensible[1]. Though POSIX is more helpful than most large standards I’ve seen, it still ends up mostly having partial implementations (are there any completely 2008-compliant systems, I wonder?). [1] http://www.landley.net/toybox/roadmap.html#susv4 http://www.landley.net/toybox/roadmap.html#susv4
- ogogmad 4y agoWhy not use sed?
- hestefisk 4y agoBecause it’s not standard.
- ogogmad 4y agoNo, it is. And as other people have pointed out, it ships on more distros. https://pubs.opengroup.org/onlinepubs/009604499/utilities/sed.html https://pubs.opengroup.org/onlinepubs/009604499/utilities/se... It's "ed" which is de facto non-standard.
- mr_toad 4y ago> The standard editor is not always standard, it seems. Linux distros don’t follow a standard anymore, as as I can tell. And Linux was never entirely POSIX compliant.
- assbuttbuttass 4y agoI always used sed for deleting lines from .ssh/config sed -i 68d .ssh/config It was an eye-opening experience for me when I realized sed and ed commands are almost identical
- Tsiklon 4y agoIt is the Stream EDitor after all.
- mananaysiempre 4y ago> oh no i reinstalled the os on my vps and now ssh has it on good authority (said authority is line 68) that someone is doing something nasty ssh-keygen -R $HOST IIRC the security warning actually used to suggest this command, but then stopped in order to discourage people from thoughtlessly bypassing it. (I don’t like this pracrice of deliberate unhelpfulness—cf Chrome’s “thisisunsafe” HSTS override—but neither do I like the results of being helpful in such cases. Ugh.) > also it's a nicely "semantic"/compact/comprehensible way of expressing patches in things like portfiles or nix expressions As far as I can tell, your ed script sans the wq at the end is a valid sed(1) script, and that is what people usually use for casual patching in packaging situations (although Nix also has substituteInPlace et al).
- krylon 4y agoIIRC, it is mandated by POSIX/SUS, so even if it ends up not being used ever, to deliberately not include it is ... doesn't feel right.