Results 1 to 8 of 8

Thread: .sh Files

  1. #1
    Join Date
    Oct 2012
    Beans
    72
    Distro
    Ubuntu

    .sh Files

    I’m messing about with .sh files.

    I want to know if like say i put:

    Code:
    gnome-terminal
    How would I set how many times it will open, without typing the command again, again and again?

  2. #2
    Join Date
    Feb 2013
    Beans
    Hidden!

    Question Re: .sh Files

    Sorry, I don't quite get what you mean. Where would you put it in? In a shell script? What for? If you call gnome-terminal from another terminal window, it will open exactly one new window, though the old terminal window will get unaccessible unless you call it asynchronously (i.e. gnome-terminal&).

    Edit.
    If you want to open several terminal windows at once, try
    Code:
    for i in {1..5}; do gnome-terminal&; done
    If you're trying to automatically start several terminals at start of an X session, I'd simply put this in ~/.xsessionrc:
    Code:
    gnome-terminal&
    gnome-terminal&
    gnome-terminal&
    A bash script to invoke several copies of gnome-terminal:
    Code:
    #!/bin/bash
    [[ -n $1 ]] || { echo Usage: $0 count >&2; exit 1;}
    
    for ((i=0;i<$1;i++)); do
       gnome-terminal&
    done
    Last edited by schragge; February 13th, 2013 at 10:04 AM.

  3. #3
    Join Date
    Oct 2012
    Beans
    72
    Distro
    Ubuntu

    Re: .sh Files

    Basicly I want, gnome-terminal to open how many times i want without typing the command again and again.

  4. #4
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: .sh Files

    Then use the bash script from my post above.

  5. #5
    Join Date
    Oct 2012
    Beans
    72
    Distro
    Ubuntu

    Re: .sh Files

    Which One?

  6. #6
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: .sh Files

    The last one. Write it in a file, make it executable (chmod +x), and put it in one of the directories on your $PATH.

  7. #7
    Join Date
    Oct 2012
    Beans
    72
    Distro
    Ubuntu

    Re: .sh Files

    Thanks.

    Also how would I use a .sh so if I run in terminal it will stay open (terminal)

  8. #8
    Join Date
    Oct 2012
    Beans
    72
    Distro
    Ubuntu

    Re: .sh Files

    I have found out my last question lol

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
  •