python 泰语拼写纠正_在Linux上使用“ cd”时如何自动纠正拼写和错别字

python 泰语拼写纠正

python 泰语拼写纠正

00_lead_image_cdspell_command_in_action

We’re used to word processing programs telling us when we’ve misspelled a word, but what about when your fingers are flying through directories on the Linux command line? You can actually have your typos and misspellings automatically corrected, at least when using the cd command.

我们习惯于使用文字处理程序来告诉我们何时拼错了一个单词,但是当您的手指在Linux命令行上的目录中穿行时呢? 实际上,至少在使用cd命令时,您实际上可以自动纠正拼写错误和拼写错误。

We’ll show you how to add a simple command to the .bashrc file that will check what you type into the cd command for transposed characters, missing characters, and too many characters.

我们将向您展示如何向.bashrc文件中添加一个简单命令,该命令将检查您在cd命令中键入的内容是否存在转置字符,丢失字符和太多字符。

The .bashrc file is a script that runs every time you open a Terminal window by pressing Ctrl+Alt+T or open a new tab in a Terminal window. You can add commands to the .bashrc file that you want to run automatically every time you open a Terminal window. To add a spell check to the cd command, we’re going to add a command to the .bashrc file.

.bashrc文件是一个脚本,每次您通过按Ctrl + Alt + T或在“终端”窗口中打开新选项卡打开“终端”窗口时运行 。 您可以将命令添加到要在每次打开“终端”窗口时自动运行的.bashrc文件。 要向cd命令添加拼写检查,我们将向.bashrc文件添加命令。

To edit the .bashrc file, we’re going to use gedit. Type the following command at the prompt.

要编辑.bashrc文件,我们将使用gedit。 在提示符下键入以下命令。

gedit ~/.bashrc

You can use any text editor you’re comfortable with, such as vi and nano. Simply replace “gedit” in the above command with the command to run your chosen text editor.

您可以使用任何您喜欢的文本编辑器,例如vinano 。 只需将上述命令中的“ gedit”替换为运行所选文本编辑器的命令即可。

01_opening_bashrc_file

Scroll to the bottom of the .bashrc file and add the following line to the end of the file.

滚动到.bashrc文件的底部,并将以下行添加到文件末尾。

shopt -s cdspell

You can add a comment above the command so you remember what the command does. Simply put a number sign (#) at the beginning of the line, and then any description you want to add.

您可以在命令上方添加注释,以便记住命令的作用。 只需在行的开头加上数字符号(#),然后再添加任何要添加的描述。

Click “Save”.

点击“保存”。

03_adding_cdspell_to_bashrc

Close gedit (or other text editor) by clicking the “X” in the upper-left corner of the window.

单击窗口左上角的“ X”,关闭gedit(或其他文本编辑器)。

04_closing_gedit

The setting you just added to the .bashrc file will not affect the current Terminal window session. You must close the Terminal window and log out and back in for the change to take affect. So, type exit at the prompt and press Enter or click the “X” button in the upper-left corner of the window. Then, log out and back in.

您刚刚添加到.bashrc文件中的设置不会影响当前的“终端”窗口会话。 您必须关闭“终端”窗口,然后注销并重新登录,以使更改生效。 因此,在提示符下键入exit ,然后按Enter或单击窗口左上角的“ X”按钮。 然后,注销并重新登录。

05_closing_terminal_window

Now, if you make a small mistake (such as transposed characters) when typing the name of a directory in the cd command, the correct spelling displays on the next line and you are automatically taken to the directory that most closely matches what you typed.

现在,如果您在cd命令中键入目录名称时犯了一个小错误(例如,转置字符),则正确的拼写将显示在下一行,并且您将自动进入与您键入的内容最匹配的目录。

06_corrected_cd_command

This is a simple solution that makes navigating directories on the command line much easier.

这是一个简单的解决方案,使在命令行上导航目录更加容易。

翻译自: https://www.howtogeek.com/267376/how-to-automatically-correct-spelling-and-typos-when-using-cd-on-linux/

python 泰语拼写纠正

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值