如果在bash(cmder)中找不到命令。
然后我需要调用我的批处理或外壳文件。
并执行自定义代码以打印结果,而不是默认结果
bash: foo: command not found
在cmder中是否有任何设置或实现此情况的其他可能方式。 如果还有其他控制台模拟器可以实现这种情况?
答案 0 :(得分:0)
您可以通过
检查命令是否可调用let retail: Array<Menu> = [
{
name: "Home",
router_link: "",
submenu: [],
toggle_submenu: false,
icon: ""
},
{
name: "Accounts",
router_link: "accounts/summary",
toggle_submenu: false,
icon: "",
submenu: [
{
name: "Summary",
router_link: "accounts/summary",
toggle_submenu: false,
icon: "",
submenu: []
},
{
name: "Tansactions",
router_link: "accounts/transactions",
toggle_submenu: false,
icon: "",
submenu: []
},
{
name: "Earnings",
router_link: "accounts/earnings",
toggle_submenu: false,
icon: "",
submenu: []
}
]
},
{
name: "Sales",
router_link: "sales",
toggle_submenu: false,
icon: "",
submenu: []
},
{
name: "Inventory",
router_link: "inventory",
toggle_submenu: false,
icon: "",
submenu: []
},
{
name: "Upload",
router_link: "upload",
toggle_submenu: false,
icon: "",
submenu: []
}
];
或在调用后,如果找不到命令(退出代码= 127)
if ! type COMMAND &>/dev/null; then
# not callable - here your script
fi