help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to call something when a command is not found?


From: Lawrence Velázquez
Subject: Re: How to call something when a command is not found?
Date: Tue, 9 Mar 2021 18:14:35 -0500

> On Mar 9, 2021, at 5:13 PM, Peng Yu <pengyu.ut@gmail.com> wrote:
> 
> Thanks. The output looks like the following,
> 
> $ /usr/lib/command-not-found shc
> Command 'shc' is available in the following places
> * /bin/shc
> * /usr/bin/shc
> shc: command not found
> 
> which is different from this. Why is it so?

Probably because you went ahead and installed shc.

> Command 'shc' not found, but can be installed with:
> sudo apt install shc
> Do you want to install it? (N/y)y

Turns out the command-not-found script behaves differently depending
on whether the command in question is actually available or not.
Outrageous.

root@localhost:~# /usr/lib/command-not-found shc
Command 'shc' not found, but can be installed with:
apt install shc
root@localhost:~# apt install shc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  shc
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 22.2 kB of archives.
After this operation, 84.0 kB of additional disk space will be used.
Get:1 http://mirrors.linode.com/ubuntu groovy/universe amd64 shc amd64 
4.0.3-0.1 [22.2 kB]
Fetched 22.2 kB in 0s (242 kB/s)
Selecting previously unselected package shc.
(Reading database ... 72915 files and directories currently installed.)
Preparing to unpack .../shc_4.0.3-0.1_amd64.deb ...
Unpacking shc (4.0.3-0.1) ...
Setting up shc (4.0.3-0.1) ...
Processing triggers for man-db (2.9.3-2) ...
root@localhost:~# /usr/lib/command-not-found shc
Command 'shc' is available in the following places
 * /bin/shc
 * /usr/bin/shc
shc: command not found

--
vq


reply via email to

[Prev in Thread] Current Thread [Next in Thread]