Results 1 to 4 of 4

Thread: Command/script to open a terminal window run multiple commands and print outputs

  1. #1
    Join Date
    Jan 2021
    Beans
    11

    Command/script to open a terminal window run multiple commands and print outputs

    Hi, this should be a very trivial question. Please how could I create a command or a script, which would open a terminal window, run a few commands printing their outputs in the terminal and then it would just wait. Thank you very much for any suggestions.
    Last edited by jazahalka; November 7th, 2021 at 06:20 PM.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Command/script to open a terminal window run multiple commands and print outputs

    Quote Originally Posted by jazahalka View Post
    Hi, this should be a very trivial question. Please how could I create a command or a script, which would open a terminal window, run a few commands printing their outputs in the terminal and then it would just wait. Thank you very much for any suggestions.
    What have you created so far? If you can type it into a terminal to get the result you want, then you can put those commands into a script and get similar outcomes if the environment is similar. There are a few caveats, but those aren't too important for beginner-level scripts.

    To open a terminal, run the terminal program. Every terminal program I've seen will happily run a command, if that is passed as an option. The option will be dependent on which terminal program you choose to use.
    The outputs from commands go to the window they are launched inside automatically.

    There are lots of different way to handle this, but usually it is easiest to put the commands into a file - call it a script - chmod +x that file and pass the full-path to the file location as an argument into the terminal. Simple. There must be 1,000 examples on the internet just like that and probably 500K example bash script to run a few commands.

    If you can type it, then it can be scripted. If really is that simple.

  3. #3
    Join Date
    Jan 2021
    Beans
    11

    Re: Command/script to open a terminal window run multiple commands and print outputs

    I am dumb, thank you very much.

  4. #4
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Command/script to open a terminal window run multiple commands and print outputs

    Quote Originally Posted by jazahalka View Post
    I am dumb, thank you very much.
    What commands, exactly, do you want to run?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •