Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何强制bash自动完成一个命令?_Linux_Bash_Shell_Autocomplete - Fatal编程技术网

Linux 如何强制bash自动完成一个命令?

Linux 如何强制bash自动完成一个命令?,linux,bash,shell,autocomplete,Linux,Bash,Shell,Autocomplete,我刚刚升级到UbuntuKarmic9.10,现在有重点了。 问题是em选项卡-不再自动完成到emacs 我有没有一种方法可以让我的Bourne Shell完成em选项卡-总是到emacs 谢谢如果您将em的别名添加到中。bashrc您可以一起跳过选项卡完成: alias em=emacs 有了此功能,您只需键入命令em即可启动emacs,如果您将em的别名添加到中。bashrc您可以一起跳过选项卡完成: alias em=emacs 这样,您只需键入命令即可启动emacsem我使用另一种方

我刚刚升级到UbuntuKarmic9.10,现在有重点了。 问题是em选项卡-不再自动完成到emacs

我有没有一种方法可以让我的Bourne Shell完成em选项卡-总是到emacs


谢谢

如果您将
em
的别名添加到
中。bashrc
您可以一起跳过选项卡完成:

alias em=emacs

有了此功能,您只需键入命令
em

即可启动emacs,如果您将
em
的别名添加到
中。bashrc
您可以一起跳过选项卡完成:

alias em=emacs

这样,您只需键入命令即可启动emacs
em

我使用另一种方法-simplee命令:

#!/bin/sh # Written by Oleksandr Gavenko , 2008. # File placed by author in public domain. # View file in emacs buffer using emacsclient. # If emacs not already running, run it. # Put this file 'e' in your PATH. # Name `e' because `edit'. case "$1" in -h|-help|--help) echo "Emacsclient run script." echo "Usage:" echo " e [-h|--help] file..." exit 0 ;; "") echo "What file you want to open?" exit 0 ;; esac if [ -n "$COMSPEC" ]; then # We probably under Windows like OS. I like native Emacs over Cygwin. for arg; do emacsclientw -a emacs -n "$arg" done else # We under UNIX like OS. for arg; do emacsclient -a emacs -n "$arg" done fi #!/垃圾箱/垃圾箱 #由奥列克桑德·加文科撰写,2008年。 #作者在公共域中放置的文件。 #使用EmacClient在emacs缓冲区中查看文件。 #如果emacs尚未运行,请运行它。 #将此文件“e”放在您的路径中。 #命名为“e”,因为“edit”。 案件“$1” -h |-帮助|-帮助) echo“EmacClient运行脚本” 回显“用法:” echo“e[-h |--help]文件…” 出口0 ;; "") echo“要打开的文件是什么?” 出口0 ;; 以撒 如果[-n“$COMSPEC”];然后 #我们可能在Windows操作系统下工作。我喜欢土生土长的Emacs而不是Cygwin。 精氨酸;做 EmacClient-a emacs-n“$arg” 完成 其他的 #我们在UNIX下像操作系统一样工作。 精氨酸;做 EmacClient-a emacs-n“$arg” 完成 fi 我还在MS Windows的批处理文件(.bat)语言中编写了类似的脚本:

@echo off REM Written by Oleksandr Gavenko , 2008. REM File placed by author in public domain. REM View files in emacs buffer using emacsclientw. REM If emacs not already running, run it. REM Put this file (e.bat) in your PATH. REM Name `e' because `edit'. REM If path to file contain spaces it must be inclosed into quotes. if x%1 == x-h goto usage if x%1 == x-help goto usage if x%1 == x--help goto usage :loop emacsclientw -a runemacs -n %1 shift if not x%1 == x goto loop goto :eof :usage @echo Alias for emacsclient without waiting for editing ending. @echo Usage: @echo e [-h^|--help] file... @回音 《雷姆》由奥列克桑德·加文科撰写,2008年。 作者在公共域中放置的REM文件。 REM使用EmacClientW查看emacs缓冲区中的文件。 REM如果emacs尚未运行,请运行它。 REM将此文件(e.bat)放在您的路径中。 REM名称'e'是因为'edit'。 REM如果文件路径包含空格,则必须将其括在引号中。 如果x%1==x-h转到使用率 如果x%1==x-help转到使用 如果x%1==x--帮助转到使用 :循环 EmacClient-a runemacs-n%1 转移 如果不是x%1==x转到循环 后藤:eof :用法 @无需等待编辑结束即可回显EmacClient的别名。 @回声使用: @echo e[-h^--help]文件。。。
我使用另一种方法-简单的e命令:

#!/bin/sh # Written by Oleksandr Gavenko , 2008. # File placed by author in public domain. # View file in emacs buffer using emacsclient. # If emacs not already running, run it. # Put this file 'e' in your PATH. # Name `e' because `edit'. case "$1" in -h|-help|--help) echo "Emacsclient run script." echo "Usage:" echo " e [-h|--help] file..." exit 0 ;; "") echo "What file you want to open?" exit 0 ;; esac if [ -n "$COMSPEC" ]; then # We probably under Windows like OS. I like native Emacs over Cygwin. for arg; do emacsclientw -a emacs -n "$arg" done else # We under UNIX like OS. for arg; do emacsclient -a emacs -n "$arg" done fi #!/垃圾箱/垃圾箱 #由奥列克桑德·加文科撰写,2008年。 #作者在公共域中放置的文件。 #使用EmacClient在emacs缓冲区中查看文件。 #如果emacs尚未运行,请运行它。 #将此文件“e”放在您的路径中。 #命名为“e”,因为“edit”。 案件“$1” -h |-帮助|-帮助) echo“EmacClient运行脚本” 回显“用法:” echo“e[-h |--help]文件…” 出口0 ;; "") echo“要打开的文件是什么?” 出口0 ;; 以撒 如果[-n“$COMSPEC”];然后 #我们可能在Windows操作系统下工作。我喜欢土生土长的Emacs而不是Cygwin。 精氨酸;做 EmacClient-a emacs-n“$arg” 完成 其他的 #我们在UNIX下像操作系统一样工作。 精氨酸;做 EmacClient-a emacs-n“$arg” 完成 fi 我还在MS Windows的批处理文件(.bat)语言中编写了类似的脚本:

@echo off REM Written by Oleksandr Gavenko , 2008. REM File placed by author in public domain. REM View files in emacs buffer using emacsclientw. REM If emacs not already running, run it. REM Put this file (e.bat) in your PATH. REM Name `e' because `edit'. REM If path to file contain spaces it must be inclosed into quotes. if x%1 == x-h goto usage if x%1 == x-help goto usage if x%1 == x--help goto usage :loop emacsclientw -a runemacs -n %1 shift if not x%1 == x goto loop goto :eof :usage @echo Alias for emacsclient without waiting for editing ending. @echo Usage: @echo e [-h^|--help] file... @回音 《雷姆》由奥列克桑德·加文科撰写,2008年。 作者在公共域中放置的REM文件。 REM使用EmacClientW查看emacs缓冲区中的文件。 REM如果emacs尚未运行,请运行它。 REM将此文件(e.bat)放在您的路径中。 REM名称'e'是因为'edit'。 REM如果文件路径包含空格,则必须将其括在引号中。 如果x%1==x-h转到使用率 如果x%1==x-help转到使用 如果x%1==x--帮助转到使用 :循环 EmacClient-a runemacs-n%1 转移 如果不是x%1==x转到循环 后藤:eof :用法 @无需等待编辑结束即可回显EmacClient的别名。 @回声使用: @echo e[-h^--help]文件。。。
我认为这是最好的解决办法。它没有完整的emacs名称,但这并不重要:)我认为这是最好的解决方案。它没有完成emacs名称,但这无关紧要:)