fbiville
fbiville

Reputation: 8950

Bash / open a terminal with a command to run passed as an argument

I created a script that starts all the apps I need for my day and assign them to the workspaces I want.

I'd like to know is there was a way to pass an argument to the terminal I open. The argument would be an alias that runs a massive source update of all the projects I'm working on.

I'd like to do something like this:

gnome-terminal start_rolls

Unfortunately, this only opens the terminal and the command is simply not run.

Any ideas ? Thanks in advance !

Rolf

P.S.: the -e option does not work with aliases, it seems...

Upvotes: 0

Views: 2703

Answers (3)

Lequerica Martin
Lequerica Martin

Reputation: 308

-e is going to be deprecated in future releases you should use something like this:

gnome-terminal -- bash -c "vim Main.java"

you can replace "vim Main.java" for whatever you want

Upvotes: 0

głupia gęś
głupia gęś

Reputation: 21

some combination of "-e", "bash -c", "bash -i" and your alias might help

Upvotes: 2

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798446

gnome-terminal --help-terminal-options says:

-e, --command Execute the argument to this option inside the terminal

Upvotes: 6

Related Questions