【问题标题】:Linux shell script livecopy of current line当前行的 Linux shell 脚本 livecopy
【发布时间】:2014-08-26 14:10:43
【问题描述】:

我需要一种方法来使用用户输入的当前行作为 shell 函数的变量。

我当前的代码,可以通过ctrl+r调用

zle -N search

bindkey "^R" search

search () {
read str;
fc -ln -30 | grep $str;
}

或者简单地说,将其作为函数调用

search () {
fc -ln -30 | grep $1;
}

目标伪代码,作为ctrl+r调用的函数调用,不需要进一步的输入提示

zle -N search

bindkey "^R" search

search () 
fc -ln -30 | grep -->vodoo-function-that-returns-current-line<--;
}

【问题讨论】:

标签: linux shell terminal user-input


【解决方案1】:

对于发现此问题并正在寻找解决方案的人How can you get the current terminal line (the one that is still editable by the user)? – user3979266

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-30
    • 2014-03-26
    • 2012-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-10
    • 2013-09-19
    相关资源
    最近更新 更多