I want to be able to launch a terminal emulator (preferably gnome-terminal) with interactive zsh running inside using a custom prompt string. I don't want to modify my default prompt string in .zshrc
because I use that most often and it is just occasionally I want to launch a terminal with a custom zsh prompt string (more specifically, I want the time to show up in the right hand side prompt).
If I already have a terminal window open, I can solve this by running:
export RPS1=%T zsh
But I can't figure out the syntax for making this work together with launching a new terminal instance. This is what I have tried with the error message below each command:
gnome-terminal -- export RPS1=%T zsh
# Error: Failed to execute child process “export” (No such file or directory)
gnome-terminal -- sh -c export RPS1=%T zsh
# Prints all the options, like with `set`
# and then exits with "The child process
# exited normally with status 0".
gnome-terminal -- sh -c "export RPS1=%T zsh"
# The child process exited normally with status 0.
gnome-terminal -- sh -c "export RPS1=%T; zsh"
# This start the terminal with zsh, but the RSP1 is not changed
I considered reading a custom rc file, like in this answer, but there does not seem to be a way of doing this in zsh without using source
, which was giving me similar problems as above.