0

I'm trying to execute multi commands in gnome-terminal? I came across an example as the below,

sudo gnome-terminal --window --wait --tab --active --geometry=120X60 \
    --title="$1" --working-directory="$code_directory"\
    -- bash -c "$file_path; exec bash"

It only works one command.

If I want to execute multiple command in step by step, for example "cd /home" and then execute "make" then something.. What am I supposed to do?

7
  • 1
    $file_path; exec bash are two commands though, so what do you mean by It only works one command.?
    – Tom Yan
    Commented Oct 25, 2023 at 9:01
  • @TomYan Yes. they are working as one command.
    – Carter
    Commented Oct 25, 2023 at 9:45
  • Sorry but I'm really not seeing what you mean. How could two commands "work as" one command? (I mean like, in terms of their "effect".) Are you saying that only the first command is executed or what? (And what was the "Yes" for?)
    – Tom Yan
    Commented Oct 25, 2023 at 10:57
  • @TomYan Sorry my bad. I mean that that 3 command are working at once. Actually I expected that they are excuted one by one.
    – Carter
    Commented Oct 25, 2023 at 11:05
  • 1
    You are running a single command, sudo gnome-terminal, which is told to run bash -c with the argument "$file_path; exec bash". The command $file_path will run first inside gnome-terminal, then the command exec bash will run inside the same gnome-terminal. So you are running "multiple commands" "one by one" already. If you are expecting something different, please be descriptive in what you are trying to accomplish. Commented Oct 25, 2023 at 19:07

0

You must log in to answer this question.

Browse other questions tagged .