From 582c60ae30d5699fc351eb0eeab4f19bd4adf538 Mon Sep 17 00:00:00 2001 From: Linwei Date: Tue, 19 Feb 2019 16:35:40 +0800 Subject: [PATCH] Updated FAQ (markdown) --- FAQ.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index 4650353..4de430b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -28,5 +28,21 @@ function j() { fi } ``` - When you are using `j xxx` it will first try `cd xxx` and then `z xxx` if cd failed. + +## How to import data from bash / zsh command history ? + +Issue [#46](https://github.com/skywind3000/z.lua/issues/46) ask for a script to import some history path from bash command history after a fresh install of z.lua and [@antonalekseev](https://github.com/antonalekseev) provided two script below: + +for bash: + +`fc -ln -10000| sed -e 's|^'[[:blank:]]' ||'|grep -o "^cd [~/].*"|sed -e "s|cd ||" -e "s|~|$HOME|" -e 's|\\ | |' -e "s|/$||"|sort|uniq|while read -r d; do test -d "$d" && echo "$d|1|0"; done >> ~/z.lua` + +for zsh: + +`fc -ln 0|grep -o "^cd [~/].*"|sed -e "s|cd ||" -e "s|~|$HOME|" -e 's|\\ | |' -e "s|/$||"|sort|uniq|while read -r d; do test -d "$d" && echo "$d|1|0"; done >> ~/z.lua` + + + + +