wok-6.x view busybox/stuff/command_not_found @ rev 21860
busybox: add command_not_found
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Sep 23 15:30:05 2019 +0200 (2019-09-23) |
parents | |
children | cf17791e53df |
line source
1 #!/bin/sh
3 ZLIST=/var/lib/tazpkg/files.list.lzma
4 LIST=/tmp/command-list
6 lookup()
7 {
8 grep -s "/$2$1$" $LIST | while read pkg file; do
9 cat <<EOT
10 Command '$1' not found, but can be installed as root with:
12 tazpkg -gi ${pkg%:}
13 ${2+$2$1}
15 EOT
16 break
17 done
18 }
20 if [ ! -s $LIST ] || [ $ZLIST -nt $LIST ]; then
21 unlzma < $ZLIST | grep -E '(/usr/games/|bin/)' > $LIST
22 fi
23 MSG="$(lookup "$1")"
24 [ "$MSG" ] || MSG="$(lookup "$1" get-)"
25 [ "$MSG" ] || MSG="${SHELL##*/}: $1: not found"
26 echo "$MSG"