Find the answer to your Linux question:
Results 1 to 4 of 4
Hi All, Is there a way to execute a very small shell script on the command line in 1 line, such that i can alias it rather than have it ...
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    4

    Shell Script to command line syntax ?

    Hi All,

    Is there a way to execute a very small shell script on the command line in 1 line, such that i can alias it rather than have it as a file ??? I will try to explain :

    - the shell script file is very small
    #!/bin/sh
    HOME=/project/projectname
    export HOME
    /project/projectname/my_exe_prog.perl

    and i want to do something like this from the command line :
    > sh HOME=/project/projectname;export HOME;/project/projectname/my_exe_prog.perl

    is "eval" wat i need or something else completely ???

    ive totally lost it this afternoon as it is friday and cant wait for the w/e to start !!!


    Many thanks in advance for your effort, support adn time in this ...

    fma

  2. #2
    Just Joined!
    Join Date
    Mar 2008
    Posts
    4
    hold on i am sooo stupid !!!

    is it simply

    > /bin/sh "commands i want to exe"

    ???

    does anyone know the syntax and/or the options i need ????

    many thanks again

    fma

  3. #3
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    If you want to finish something quickly before the weekend comes, the best way is to look at the documents yourself. :)

    Do this at the command line:
    Code:
    man bash
    If man pages are not installed on your system, google this:
    Code:
    man bash Linux
    Good luck! :)
    --
    Bill

    Old age and treachery will overcome youth and skill.

  4. #4
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    452
    welcome to the forum

    > Is there a way to execute a very small shell
    > script on the command line

    > the shell script file is very small
    > #!/bin/sh
    > HOME=/project/projectname
    > export HOME
    > /project/projectname/my_exe_prog.perl

    you have several choices:

    1. alias m_e_p='export HOME=/project/projectname;\
    $HOME/my_exe_prog.perl'

    2. source m_e_p (where m_e_p is the script: needn't be all on
    one line)--need to rewrite m_e_p as a function
    m_e_p () { m_e_p as before }

    3. chmod a+x m_e_p (with the file in your path: I use
    /usr/local/bin

    in each case, the command "m_e_p" should cause the
    script to execute.
    the sun is new every day (heraclitus)

Posting Permissions

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