Hacker News new | ask | show | jobs
by WalterGR 1704 days ago
In the recent history sh(1) has gain the missing features for it to become a usable interractive shell:

- command completion

- ...

Too much bloat for my tastes.

5 comments

What's the harm?

I'm guessing your alternative is:

  echo $PATH | sed 's/:/\n/g' | xargs ls | grep command_im_looking_for
Additionally, an empty element in this context means $PWD
I mean, preferences are preferences but you can hardly call command completion 'bloat'
I assumed this was sarcasm and I am surprised to read all the serious replies.
Doesn’t command completion cause a disk scan? Which can be a problem if the system is failing in some way and you’re trying to recover.
Can you not just avoid activating a completion attempt if you are in that scenario?
I think it is not as easy as you imply, especially if it is bound to muscle memory.

Side note: https://www.google.com/search?q=don%27t+say+just

What percentage of your time do you spend on a shell on a host where the disk is failing and tabbing could cause a catastrophic disk read vs being on a perfectly healthy system where tab complete is a nice feature?
What percentage of your time do you spend logged in as root? ;)
unless you're exclusively running shell built-ins, doesn't running any command at all potentially cause a disk scan
Usually the shell creates a cache of commands on start, which can be refreshed with `hash -r`.
As far as I can tell the hash table is initially empty after you first start the shell. At least, that's the case for bash.

  $ hash
  hash: hash table empty
Reminds me of the times I've had run out of space in a Linux system. When you SSH to the system and press TAB for command completion, all you get is some message regarding "the system running out of space".
Maybe in sh type shells. In csh/tcsh commands are hashed, so command completion is in memory. Thus the need for rehash.

There is a new setting in tcsh to allow for automatic rehash, but I have it disabled.

hash -r in bash. No idea if there's a setting, I'm too used to doing the rehash as required to've noticed if there was.
Can install dash from ports collection. Should work fine as scripting shell in place of this one.
I would avoid this for root.