Skip to content

Instantly share code, notes, and snippets.

@edgardleal
Last active July 9, 2016 21:22
Show Gist options
  • Save edgardleal/33495742fdf5da786e6bfe5b0383036b to your computer and use it in GitHub Desktop.
Save edgardleal/33495742fdf5da786e6bfe5b0383036b to your computer and use it in GitHub Desktop.
Import bash_history to your zshell history file ( ~/.zsh_history )
#!/bin/bash -
#title :import_bash_history_to_zshell.sh
#description :This script import all commands history finded in ~/.bash_history to ~/.zsh_history in zshell format
#author :Edgard Leal <edgardleal@gmail.com>
#date :20160705
#version :0.1
#usage :bash import_bash_history_to_zshell.sh
#notes :
#bash_version :4.1.5(1)-release
#==============================================================================
set -eu
declare -r bash_file="${HOME}/.bash_history"
export zsh_file="${HOME}/.zsh_history"
# get epoc time
export time="$(date +%s)"
cat "$bash_file" | xargs -0 -I@ echo ": $(($time +1)):0;@" >> $zsh_file
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment