169 похожих чатов

Guys I want to handle bash 'Command not found' I want

if a command not found the command analyzed and if needed take an action, else throw command not found
What should I do?

17 ответов

11 просмотров

Write better bash

check if command exists before doing anything

https://www.redhat.com/sysadmin/learn-bash-scripting

Dmitry Ylnui
that's not helpful

It's greatly helpful in the bigger scheme of things

Raptor Blue Bear
It's greatly helpful in the bigger scheme of thing...

eating better and working out will be even more helpful, why didn't you advice him this?

Actually you most likely can do something with plugins/modules I remember on Fedora it searche for the command and proposed to install There is also something in zsh that propose to execute another command that looks like the one you tried

Dmitry Ylnui
if ! command -v whatever; then echo whatever mus...

I prefer to use the command hash to check if something is installed if that was the intent here.

Dmitry Ylnui
why?

Honestly cannot remember what led me down that rabbit hole but it works in more situations than using "which" to search for existence then taking action if that returns nothing or just trying to run the command itself

Ehsan- Автор вопроса
Ehsan- Автор вопроса
Deadly Q Continuum of Death aka Le Baguette Toxique The Maximalist Minimalist vichy republican From Outer Space
Actually you most likely can do something with plu...

Actually I want to handle a common situation with multi language keyboard When my keyboard is not English, command 'ls' will be for example 'xy' I want to parse command and possibly convert it to correct one Is it OK for the solution?

Похожие вопросы

Обсуждают сегодня

А еще в перле можно уже @arr1 + @arr2?
Sergei Zhmylove
53
я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
Подскажите, где смотреть результат выполнения программы? Код: ;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, станда...
Егор Анелькин
5
Привет всем. появился вопрос. Разрабатываю сайт, в данный момент он запущен. Хостинг beget. Добавляю на сайт яндекс метрику с помощью полей client-settings (взято отсюда http...
Andrew
2
;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, стандартный ;вызов процедуры ;option casemap:no...
Егор Анелькин
1
почому оно не работает?
Vi Chapmann Chapmann
19
Так а кто может спарсить всех участников чата? Идишники
Magic
18
Есть вопрос: допустим есть железка с каким-то интерфейсом(допустим usb), но как по этому интерфейсу железкой управлять неизвестно, прог нету, а управлять очень хочется надо. К...
Mixail Frolov
15
а как ловят такое ghci> res <- getPos2 urlt 0 (alist !! 0) 200 ghci> res SearchAtom (Search "www.google.com" "/search?q=" "Haskell") "haskell.org" (SearchTS [(2024-05-06 07:...
Fedor
14
короче сгенерила мне эта штука код на ассемблере: struc string val { common local .value dq .value .value: if ~val eq db val end if db 0 } fo...
Vi Chapmann Chapmann
12
Карта сайта