Looks complex. (-:
C shell:
% printf '%s\n' $path
Z shell:
% printf '%q\n' "$path[@]"
I was about to write the same thing.
And as @steeph pointed out, getopt in shell script does not allow one to do several things, including take advantage of the Z shell's ability to automatically construct command-line completions for anything that supports --help .
It's going to get less accurate as the months go by. It's a simple #arithmetic trick, and you can tell which year the image was faked for.
The number, in repetitions on the WWW, goes as low as 78, so you can tell what year this trick began doing the rounds, too.
Now for true mentalist tricks, look at how the GNU date command and a POSIX-conformant shell can magically, with just one line, work out the year that you were born:
date -r "-$(((2+1)*3*2*5*487*6*10*9<<4))" +'%Y'
@rl_dane hit the nail on the head.
This isn't really specific to completion. It's just general overlong input line editing behaviour.
The PD #KornShell and its derivatives (e.g. the #MirBSD Korn Shell) only have line editing with a single line that sideways scrolls.
ksh93, however, has a
set -o multiline
option for switching to a multiple-line line editing mode. (The Z and Bourne Again shells have similar.)
You might like the Watanabe shell. It's in ports.
I was curious as to what this meant, so I fired up PD ksh and tried what I thought long command-prompt entries meant.
The PD #KornShell uses a column width greater than the terminal width (which I set to 50 columns here, just to make things easier) because it SPC-pads everything to the length of the longest string; and ends up double-spacing most rows in the table as a consequence.
I couldn't figure out how to get it to specifically clip rows, though.
Tried it. It didn't clear the screen.
If you want another voyage of discovery, try to track down the first shell that monitored the mailbox and printed a new mail notification before printing its prompt.
That's not the Bourne shell.
That's the Almquist shell, first posted to comp.sources.unix in 1989 as v19i001 to v19i008. #KennethAlmquist was at the University of Washington.
The Bourne shell was released a decade earlier, and was copyrighted AT&T work.
No current BSD has the Bourne shell in base, because of the 1980s AT&T copyright problems.
#FreeBSD and #NetBSD have the Almquist shell as sh and #OpenBSD has one of the Korn shell variants.
It's worth bearing in mind that (a) non-interactive shells used by automatic tools should not really end up running .bashrc/.zshrc, and (b) the aforementioned "nx" attack was targetting systems that had real users's home directories (containing passwords, keys, and whatnot).
So, strictly, it's not passwordless "sudo" alone. It's passwordless "sudo" appended to .bashrc/.zshrc, running "shutdown".
Nx package on npm hijacked to steal cryptocurrency wallets, GitHub/npm tokens, SSH keys, and environment secrets - and is the first documented case of malware weaponizing AI CLI tools for reconnaissance and data exfiltration.