I need a bash script that does the following:
- open a new terminal
- change to a specific directory
- run a command in that directory
- keep the terminal open for further use
Specifically I want to:
- open the konsole terminal
- change to
/my/work/dir/
- inside
/my/work/dir/
, runsource bin/activate
- after that I need to run further commands inside
/my/work/dir/
, e.g.ls
A very similar question was given the following answer for the script (adapted to my requirements):
#!/usr/bin/env bash
konsole --noclose --workdir /my/work/dir/ -e 'bash -c 'source bin/activate''
This does open a new terminal inside /my/work/dir/
, but the terminal is not interactive. The
user@userMachine: /my/work/dir$
is missing that allows me to run further commands and anything I type (e.g. pwd
) returns nothing, just new lines.