Skip to content

Instantly share code, notes, and snippets.

@Zensey
Last active February 23, 2022 21:23
Show Gist options
  • Save Zensey/065d3dee156ab800af07d3fa0bf21807 to your computer and use it in GitHub Desktop.
Save Zensey/065d3dee156ab800af07d3fa0bf21807 to your computer and use it in GitHub Desktop.
A .bashrc addition for separation of history files
#!/bin/bash
dir=.history.d
if [ ! -d ~/$dir ]
then
mkdir -p ~/$dir
touch ~/$dir/ssh
touch ~/$dir/dev
touch ~/$dir/adm
touch ~/$dir/games
fi
pushd ~/$dir/ >/dev/null
list=$(find * -type f)
popd >/dev/null
select opt in $list
do
if [ ! -z "$opt" ]
then
#echo $opt
f=$opt
export HISTFILE="${HOME}/$dir/$opt"
fi
break
done
prefix=$(printf %s $f)
PS1="[${prefix}] "$PS1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment