如何将键绑定到CTRL-r以在bash中进行反向搜索

时间:2016-08-05 13:58:46

标签: bash search scripting

我在.bash_profile

中尝试了以下操作
bind '"rr":"^R"' 
当我在bash提示符中键入reverse-i-search时,

打开rr提示符,但这似乎不起作用。有什么想法吗?

2 个答案:

答案 0 :(得分:3)

bind '"rr":reverse-search-history'

应该成功。 keyseq:function-name绑定的第二部分必须是readline函数名,而不是另一个keyseq。要了解有关readline函数的更多信息,请访问man bash并转到READLINE部分。

答案 1 :(得分:1)

public async static void DownloadPage(string url) { CookieContainer cookies = new CookieContainer(); HttpClientHandler handler = new HttpClientHandler(); handler.CookieContainer = cookies; using (HttpClient client = new HttpClient(handler)) { using (HttpResponseMessage response = client.GetAsync(url).Result) { //statusCode CheckStatusCode(response); //header HttpHeaders headers = response.Headers; //content HttpContent content = response.Content; //getRequestVerificationToken&createCollection string newcontent = CreateCollection(content); using(HttpResponseMessage response2 = client.PostAsync(url,)) } } } public static string GenerateQueryString(NameValueCollection collection) { var array = (from key in collection.AllKeys from value in collection.GetValues(key) select string.Format("{0}={1}", WebUtility.UrlEncode(key), WebUtility.UrlEncode(value))).ToArray(); return string.Join("&", array); } public static void CheckStatusCode(HttpResponseMessage response) { if (response.StatusCode != HttpStatusCode.OK) throw new Exception(String.Format( "Server error (HTTP {0}: {1}).", response.StatusCode, response.ReasonPhrase)); else Console.WriteLine("200"); } public static string CreateCollection(HttpContent content) { var myContent = content.ReadAsStringAsync().Result; HtmlNode.ElementsFlags.Remove("form"); string html = myContent; var doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(html); var input = doc.DocumentNode.SelectSingleNode("//*[@name='__Token']"); var token = input.Attributes["value"].Value; //add all necessary component to collection NameValueCollection collection = new NameValueCollection(); collection.Add("__Token", token); collection.Add("return", ""); collection.Add("Email", "11111111@hotmail.com"); collection.Add("Password", "1234"); var newCollection = GenerateQueryString(collection); return newCollection; } 键绑定到rr命令似乎就像这样工作

reverse-search-history