Results 1 to 5 of 5

Thread: newbie command line start program with arg

  1. #1
    Join Date
    Apr 2008
    Location
    Stockholm, Sweden
    Beans
    23
    Distro
    Ubuntu Studio 9.04 Jaunty Jackalope

    Question newbie command line start program with arg

    Hi there.

    I'm a bit of a newbie and have a problem.
    Sure there is a solution and hope that someone with the knowledge is willing to help me.

    I have a simple terminal application when started I have 10 options.

    I start the program and then choose 1 option by typing 1-10.

    I would like to be able to start the program with an option/argument so that it automatically starts with option 1, 2, 3 and so on.

    So the program must be started and then have the input.

    Maybe a script?

    Or is there a way to do it from the command line?

    If any thing is unclear (most likely, since the explanationis a bit hmmm) please ask.

    Think it's written in python.

    / Twinned

  2. #2
    Join Date
    Mar 2008
    Beans
    4,715
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: newbie command line start program with arg

    If the program is called test.py you can send a "1" to stdin by running:
    Code:
    test.py <<< 1

  3. #3
    Join Date
    Jul 2008
    Location
    Alabama, USA
    Beans
    906
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: newbie command line start program with arg

    use: "echo 1 | application"

    where 1 is the text that you would normally type by hand and application is the name you use to open your application.

  4. #4
    Join Date
    Jul 2008
    Location
    Alabama, USA
    Beans
    906
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: newbie command line start program with arg

    Quote Originally Posted by unutbu View Post
    If the program is called test.py you can send a "1" to stdin by running:
    Code:
    test.py <<< 1
    ooh, neat... Somehow, I never knew about that bash trick.

  5. #5
    Join Date
    Apr 2008
    Location
    Stockholm, Sweden
    Beans
    23
    Distro
    Ubuntu Studio 9.04 Jaunty Jackalope

    Smile Re: newbie command line start program with arg

    undecim

    Marvelous!!

    Exactly what I was looking for and it worked perfect.

    Thank you VERY much.

    And thank you unutbu.

    Amazingly swift answers from both of you.

    It wasn't python, should have known since it didn't end with .py

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
  •