0

Is it possible to make a command that does something, Opens another terminal and then does something there? Im trying to combine the start up of a server and its api.

"god": "next dev && cd server && strapi develop" I want the 'cd' part to start in a new terminal. Ive tried open -a terminal but it doesnt seem to work.

2 Answers2

0

you can try to use tmux for that

tmux new-session \; \
  send-keys 'next dev' C-m \; \
  split-window -h -p 50 \; \
  send-keys 'cd server && strapi develop' C-m \;
m_g
  • 61
  • 1
  • 6
0

If I understand the question correctly, you simply need to run two commands in parallel. This can be achieved easily in bash:

command1 & command2  # will run command1, send it to background,
                     # and run command2 (which will be kept in foreground)

In your case:

next dev & cd server && strapi develop

You can read more about this here: How do you run multiple programs in parallel from a bash script?

Martin Heralecký
  • 5,649
  • 3
  • 27
  • 65