if a command not found the command analyzed and if needed take an action, else throw command not found
What should I do?
write your own shell
Write better bash
check if command exists before doing anything
https://www.redhat.com/sysadmin/learn-bash-scripting
that's not helpful
It's greatly helpful in the bigger scheme of things
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
if ! command -v whatever; then echo whatever must be installed exit 1 fi
a bit long each time I want to run a command
otherwise yeah, oh-my-zsh has plugin for that iirc
I prefer to use the command hash to check if something is installed if that was the intent here.
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
Write in C ?
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?
Обсуждают сегодня