4 ms·
20 years of administering Linux systems and I didn't know the read -s trick.
by bandrami 10mo ago
20 years of administering Linux systems and I didn't know the read -s trick.
- wahern 10mo agoread -s in pdksh does nearly the opposite, saving the string to your history file! See https://man.openbsd.org/ksh#read https://man.openbsd.org/ksh#read pdksh is the system shell on OpenBSD, among others, and I just confirmed this is indeed what it does in OpenBSD. EDIT: FWIW, ksh93 also behaves like pdksh (inherited ksh88 feature?), while zsh behaves like bash. read -s was added to bash 2.04 (2000) and zsh 4.1.1 (2003, committed 2002), both long after the flag was used in ksh--at least as early as the initial pdksh commit to OpenBSD in 1996.
- bandrami 10mo agoYeah, I came to Linux from BSD and still have some ksh and csh muscle memory from The Before Time
- chasil 10mo agoAs pdksh has aged into memory, OpenBSD's version is now known as oksh. Android selected another fork, mksh, as their system shell. This is also included in Red Hat, along with ksh93. I had read that zsh has strict emulation modes for ksh and bash. Is it possible that zsh behavior changes when those are triggered?
- wahern 10mo ago> Is it possible that zsh behavior changes when those are triggered? It doesn't look that way, at least looking at the option handling code in the read builtin (bin_read): https://github.com/zsh-users/zsh/blob/8a3ee5a/Src/builtin.c#L6546 https://github.com/zsh-users/zsh/blob/8a3ee5a/Src/builtin.c#...
- chasil 10mo agoNote that "read -s" is not POSIX, and thus is not portable. The only allowed argument to POSIX read is "-r" which is enforced in Debian/Ubuntu by the dash system shell. https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/read.html https://pubs.opengroup.org/onlinepubs/9699919799.2018edition...