cal 命令不起作用

cal 命令不起作用

我尝试通过终端中的“cal”命令访问日历,但出现错误消息。

hetz@hetz-Lappy:~$ cal
bash: cal: command not found

答案1

我建议首先安装command-not-found以帮助解决如下错误:

sudo apt install command-not-found

然后打开一个新终端以确保其功能可用。

现在,当您尝试运行时cal,您将收到一个更有用的错误消息,它将告诉您要安装哪个包:

Command 'cal' not found, but can be installed with:
sudo apt install ncal

答案2

安装ncal软件包:

sudo apt install ncal

如果您已command-not-found安装并启用(Bash 中默认启用),则应该会收到安装该软件包的建议。如果您使用 Zsh,请将这些行复制到/etc/bash.bashrc您的.zshrc(或为您的 Zsh 框架启用相关插件):

# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
    function command_not_found_handle {
        # check because c-n-f could've been removed in the meantime
        if [ -x /usr/lib/command-not-found ]; then
           /usr/lib/command-not-found -- "$1"
           return $?
        elif [ -x /usr/share/command-not-found/command-not-found ]; then
           /usr/share/command-not-found/command-not-found -- "$1"
           return $?
        else
           printf "%s: command not found\n" "$1" >&2
           return 127
        fi
    }
fi

答案3

出于某种原因,我遇到了同样的问题卡尔在发行版安装中不再存在,我建议安装分数如下:

snap install fcal- 必须以 root 用户身份运行

之后你将得到命令分数可用,它将表现得像卡尔(其实不然,但它是一种解决方法)。

相关内容