3

OS: Linux mint 19.2 Cinnamon SHELL: Zsh TERMINAL: Tilix

I want to create a shell script. which have 2 steps.

  1. Open the new terminal.
  2. Run source bin/activate at terminal that I opened.

How do I run source bin/activate command in specific shell?

I think keypoint is pid.

I think that If I use pid, it works.

How do I run source bin/activate command in specific shell?

Relationship:I want to create the launcher. When I click it, which open the shell and run `source ~/venv/bin/activate && cd ~/workspace/python_script`

pastelkona
  • 31
  • 3

1 Answers1

0

We will use the ZDOTDIR environment variable to source a custom startup file. Create a directory, e.g. ~/.config/zsh/ and create a .zshrc file in there with the following contents:

#!/bin/sh
# By default, this file will not be sourced by zsh.

# Source config files at the default places:
. ~/.zshrc
. ~/.zshenv

# custom commands:
. ~/bin/activate

Now you can run (replace $TERMINAL with your terminal emulator, e.g tilix)

ZDOTDIR=~/.config/zsh $TERMINAL -e zsh

to open a new terminal running zsh with a custom ZDOTDIR.

Also See: Zsh Startup/Shutdown files – ArchWiki

Devon
  • 808
  • 8
  • 12