Search code examples
linuxbashshellzsh

Using standard shells to build a custom app-specific shell


I am wondering if it's possible to use standard shells e.g. bash or zsh with alternative profile and alternative history files to handle specific commands.

The motivation for doing this comes from using applications such as taskwarrior or timewarrior which make me type in a lot of commands that I don't want to interfere with history files of my "standard" use. This conflicts mainly with Ctrl+R functionality.

Ideally, I would like to carry on with my standard shell and ignore all task and timew but open another shell (with some options and modifiers) which will source a different profile and use an alternative history file.

This will create an experience similar to interactive modes of various interpreters e.g. ipython, gnuplot.

Please let me know if you have any ideas.


Solution

  • Yes, that isn't difficult at all. bash -rcfile <filename> will run the file <filename> instead of your usual rc file. Then in that file set the shell variable HISTFILE to a custom history file.