Skip to content

Instantly share code, notes, and snippets.

@tmiland
Last active November 25, 2022 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmiland/ec30ca392ec53520dbbfccb9012046ee to your computer and use it in GitHub Desktop.
Save tmiland/ec30ca392ec53520dbbfccb9012046ee to your computer and use it in GitHub Desktop.
Script to import zsh history to bashhub server
#!/usr/bin/env bash
# Execution time was ca. 50 minutes for 10000 lines
# Cleans out everything before ; e.g ": 1548515910:0;"
cat $HOME/.zsh_history | cut -d \; -f 2 | uniq > $HOME/.zsh_history_clean
# Cleaned tmpfile
filename=$HOME/.zsh_history_clean
# Do the work
while read -r line; do
bashhub save "${line}" / 0 0 0;
echo "${line}";
done < $filename
# Delete tmpfile
rm $filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment