Why theIf 'root' defaults to tcsh and 'toor' defaults to bash, how about 'otro' defaults to 'sh'?
We can also add 'troo' for ksh and 'roto' for zsh, while we're at it
Why theIf 'root' defaults to tcsh and 'toor' defaults to bash, how about 'otro' defaults to 'sh'?
On FreeBSD, yes. Tcsh is just an improved C shell, and a C shell is canonically named csh, so csh is just an alias name here.never understood why there is csh AND tcsh (these are the same right?)
su -m
(short for su -m root
), and you're there. su -
will usually suffice. leng=$(expr length $str)
to get the length of a string, but with sh, I must use leng=${#str}
.Yes, ${#str} is the more portable alternative. My point was that${#str} works in bash (should be posix)
bash can do some proprietary "expansions" like substring and replace
Code:z>echo $TERM ${TERM: -2:3} xterm-256color or z>echo $TERM ${TERM: 0:5} xterm-256color xterm z>echo $TERM ${TERM/color/mono} xterm-256color xterm-256mono z>
expr length
doesn't work with /bin/sh on FreeBSD.Why not? Only two dependencies (autoconf, automake), 809KB, also the name would play nice along with ZFS. There's something about Z in FreeBSD!IMHO as ZSH license is MIT the FreeBSD should import ZSH into FreeBSD base and make ZSH the default shell.
OK, but then please with an easy way of switching off bracketed paste. I understand why others want/need this, but it breaks my workflow. Over the years I collected a countless number of minutes of system maintenance tasks. The minutes are text files in the form of interactive shell commands. These can be replayed step-by-step by dragging and dropping it line by line from the respective minute file into the Terminal window. Bracketed paste brakes this horribly, and I found no way to disable this with zsh.As FreeBSD's /bin/sh also supports completion its pointless to stick to TCSH (or CSH) as the default shell. We can keep them in base for historic reasons tho.
TCSH/CSH are terrible for scripting or even many simple 'one liners' in interactive mode fail to work.
I never use them and I always switch to ZSH.
IMHO as ZSH license is MIT the FreeBSD should import ZSH into FreeBSD base and make ZSH the default shell.
Regards.
set enable-bracketed-paste off
"\e[A": history-search-backward
"\e[B": history-search-forward
Why do we care about dependencies, when these are compile-time dependencies, the resulting binary is packaged in the base (so people don't need to recompile it unless thy want to), and the only two dependencies are things that most compilations need anyway?Why not? Only two dependencies (autoconf, automake), 809KB, also the name would play nice along with ZFS. There's something about Z in FreeBSD!
I think you can turn off bracketed paste in your terminal emulator. At least iTerm (on a Mac) has that option. Does that fix your problem?OK, but then please with an easy way of switching off bracketed paste.
# shell_command # issued by root
# another_command # Also issued by root
> shell_command # issued by regular user
I use the Terminal app which comes with the OS, and there is not an option to turn off bracketed paste for a ssh session. Regarding your log-file format, this would be easy to resolve with sed(1).I think you can turn off bracketed paste in your terminal emulator. At least iTerm (on a Mac) has that option. Does that fix your problem?
BTW, I do exactly the same thing: I keep log files when doing system administration, and I cut and paste all relevant commands into the log files. My problem is that I have built myself roadblocks: I always record the commands in the format
Which means that if I paste a multi-line sequence, the commands either are commented out, or consist of a redirect which causes syntax errors. I could start fixing that habit, but I have >20 years of accumulated log files with good comments, and it's too much work to go back and clean them all up.Code:# shell_command # issued by root # another_command # Also issued by root > shell_command # issued by regular user
sed -e 's|^# ||;s| # .*||' -i ".commented" logfile.txt
IMHO as ZSH license is MIT the FreeBSD should import ZSH into FreeBSD base and make ZSH the default shell.
Regards.
shells/oksh. There's also shells/mksh that it's similar and I like it.The OpenBSD KSH is also fairly effective.
(https://github.com/ibara/oksh)
But I suppose frankly all of this stuff can be installed from ports. sh and csh are "good enough" in base.
I am also one of those heretics that installs bash(-static) in there anyway![]()
Try putting this into ~/.zshrc:OK, but then please with an easy way of switching off bracketed paste.
zle_highlight+=(paste:none)
This is the only real response here, IMO. If you have an opinion, you can just change it. That's the point of the emphasis on "not removing from base."I don't really care what the default root shell is
Well, I have an opinion that a C shell in base is unnecessaryThis is the only real response here, IMO. If you have an opinion, you can just change it. That's the point of the emphasis on "not removing from base."
WITHOUT_TCSH=yes
I don't know why but when I read that this sketch popped up in my mind immediately."no, I don't suggest removing it !!!!!111eleven"
This does not disable bracketed paste as such, it disables the visual effect only. See also: https://forums.freebsd.org/threads/bracketed-paste.81314/post-522692Try putting this into ~/.zshrc:zle_highlight+=(paste:none)
I guess you are right. I was replying in that thread too. But as I had a second look there today it seems memreflect said this and way more before I did reply (not sure why I was replying there then to be honest).This does not disable bracketed paste as such, it disables the visual effect only. See also: https://forums.freebsd.org/threads/bracketed-paste.81314/post-522692
PS: The hacky way of disabling bracketed paste given in said post does work.