LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-10-2012, 09:54 AM   #1
Katsnor
LQ Newbie
 
Registered: Sep 2012
Posts: 2

Rep: Reputation: Disabled
Input from program


Hi,

we have a Universe database and we already know how to shell down to command line and call the shell script, but we don't know ho to modify the scripts to accept input from the program. Can you help me please??
The program uses the following syntax to call the shell script:


SIN=\"sendEmail -f \:FROM:\@gwk.co.za -t \:TO:\@gwk.co.za -u '\:SUBJECT:\' -m '\:MESSAGE:\' -a '\:ATTACHMENT:\'"\
EXECUTE \SH -c \:SIN

The script that is called:

Code:
#!/bin/bash
a=$1

foo ()
{
vlag=''
subject=''
att=''
to=''
empty='empty'
message=''
counter=1

for ARG in "$@"
do
if test "$vlag" = "$empty"
then
    vlag=$ARG
else
     case $vlag in
     -t)
          if test $counter -eq 1
          then 
               to=$ARG
          else
               to=$to","$ARG
          fi
          counter=2;;
     -a)
          att=$att" -attach "$ARG;;
     -u)
          subject=$ARG;;
     -m)
          message=$ARG;;
     esac
     vlag="empty"
fi

done
emailstring="email -s '"$subject"' "$att" "$to
echo $emailstring
eval $emailstring
}

CAN YOU PLEASE HELP ME????

Last edited by onebuck; 09-10-2012 at 10:27 AM. Reason: vbcode tags to cleanup post
 
Old 09-10-2012, 10:31 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Moderator Response

Please do not hijack threads. Since you did not provide constructive information to the old thread, your post has been moved to this new thread.

Please do not resurrect old thread unless you have something to contribute.
 
1 members found this post helpful.
Old 09-11-2012, 10:00 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,617

Rep: Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963
Quote:
Originally Posted by Katsnor View Post
Hi,
we have a Universe database and we already know how to shell down to command line and call the shell script, but we don't know ho to modify the scripts to accept input from the program. Can you help me please??
The program uses the following syntax to call the shell script:

CAN YOU PLEASE HELP ME????
First, go back and read the LQ rules you agreed to when you signed up. You posted this same question FOUR TIMES, hijacked others threads with your own question, and re-opened an old thread. None of those things makes people too excited to help you.

Second, your question is basically "how can I get a shell script to take command line arguments?". Had you bothered to put that question into Google, you'd have found these first three hits:
https://www.linuxquestions.org/quest...script-254396/
http://www.java-samples.com/showtuto...utorialid=1375
http://how-to.wikia.com/wiki/How_to_..._a_bash_script

...with examples. There are also THOUSANDS of shell-scripting tutorials you can easily find, if you tried to look.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Awk: Input from one line, execute program; input from next line, execute program C.L. Programming 9 09-27-2010 12:06 AM
send input to running program mattmarion Linux - Newbie 3 03-03-2008 01:03 PM
input avoided in my c program. nflenz Programming 6 12-12-2006 01:47 PM
Does anyone know you to use Vim for perl program input? fudam Programming 8 07-31-2006 01:40 AM
Program gets aborted on large input shinni Programming 4 03-12-2005 09:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration