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 ...
- 03-28-2008 #1Just 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
- 03-28-2008 #2Just 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
- 03-28-2008 #3
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:
If man pages are not installed on your system, google this:Code:man bash
Good luck! :)Code:man bash Linux
--
Bill
Old age and treachery will overcome youth and skill.
- 03-29-2008 #4Linux 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)


Reply With Quote