“.”命令在 fish 中不起作用

“.”命令在 fish 中不起作用

我正在使用 fish,并尝试激活虚拟环境,因此我尝试了 fish 中显然不可用的“source”命令。最后我得到了这个关联其中写道:

“.(单个句点)是 source 命令的别名。已弃用 .,改用 source,并且将在 fish 的未来版本中删除 .。”

我尝试过“。/home/tax/venv/shopify-env/bin/activate”,但也不起作用;这是错误:

fish: Illegal command name “}”
/home/tax/venvs/shopify-env/bin/activate (line 37): }
                                                    ^
in . (source) call of file “/home/tax/venvs/shopify-env/bin/activate”,
    called on standard input,

fish: Could not locate end of block. The “end” command is missing, misspelled or a “;” is missing.
/home/tax/venvs/shopify-env/bin/activate (line 78): if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
                                                    ^
in . (source) call of file “/home/tax/venvs/shopify-env/bin/activate”,
    called on standard input,


       if - conditionally execute a command

   Synopsis
       if CONDITION; COMMANDS_TRUE...; [else if CONDITION2;
       COMMANDS_TRUE2...;] [else; COMMANDS_FALSE...;] end

   Description
       if will execute the command CONDITION. If the condition's exit status
       is 0, the commands COMMANDS_TRUE will execute. If the exit status is
       not 0 and else is given, COMMANDS_FALSE will be executed.

       In order to use the exit status of multiple commands as the condition
       of an if block, use begin; ...; end and the short circuit commands and
       and or.

       The exit status of the last foreground command to exit can always be
       accessed using the $status variable.

   Example
       if test -f foo.txt
            echo foo.txt exists
       else if test -f bar.txt
            echo bar.txt exists
       else
            echo foo.txt and bar.txt do not exist
       end

       will print foo.txt exists if the file foo.txt exists and is a regular
       file, otherwise it will print bar.txt exists if the file bar.txt exists
       and is a regular file, otherwise it will print foo.txt and bar.txt do
       not exist.

.: Error while reading file “/home/tax/venvs/shopify-env/bin/activate” 

“source”和“.”命令在 bash 中都可以正常工作。

我使用了错误的命令吗?fish 中的“.”命令是否被删除了?或者其他什么?

答案1

鱼中的“.”命令是否被删除了?或者其他什么?

在您引用的摘录中:

. 的使用已被弃用,取而代之的是 source,并且 . 将在 fish 的未来版本中被删除。

我想这回答了你的问题。

互联网是一个档案。有些陈述在撰写时可能是正确的,但尚未更新。“未来版本的鱼”现在可能就是当前版本。

相关内容