How to execute application command in shell script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to execute application command in shell script?
# 1  
Old 03-20-2015
How to execute application command in shell script?

friends,
i have application commands to execute in shell script it is something like this. i will login with user data it takes me to $ prompt. Example given below

Code:
login: data
ps : xxxx
$ MNSinput --this takes me to greater than prompt >
> ops --this is command i enter this output has to get redirect then next command
> proc - This output also has to get redirect to file

The below script not working output of application command not getting redirected. Pls help in getting solution.

Code:
df -k  >> GUR_DG1_HC_$lnodee;
echo '------------------------------' >output
  {
       sleep 5
       echo datagrid
       sleep 3
       echo datagrid
       sleep 3
       MNSinput  
       sleep 5
       ops >> output
       sleep 5
       proc >> output
       sleep 5
       echo exit
}| telnet 10.185.43.23

---------- Post updated at 02:08 AM ---------- Previous update was at 02:06 AM ----------

sorry small change in script

Code:
df -k > out
echo '------------------------------' >>output
{
sleep 5
echo datagrid
sleep 3
echo datagrid
sleep 3
MNSinput 
sleep 5
ops >> output
sleep 5
proc >> output
sleep 5
echo exit
}| telnet 10.185.43.23

---------- Post updated at 05:42 AM ---------- Previous update was at 02:08 AM ----------

Friends,
pls provide solution for the above script

Last edited by Neo; 03-20-2015 at 05:08 AM.. Reason: code tags
# 2  
Old 03-20-2015
Not sure I understand your request. What exactly is going wrong?
# 3  
Old 03-20-2015
hi,
I am not able to redirect the output of application command in solaris in simple to understand the script is something like this

$ MNSinput --this application command takes to > prompt (greater than prompt)

> ops - this is application command, want to redirect output of this command to file

> mns- this is also application command, want to redirect output of this command to file

So i am not able to redirect output for above.
# 4  
Old 03-20-2015
Hi have two date and format is yyyy-mm-dd
start_dt and end_dt. I need to find the difference and fetch the dates in between start_dt and end_dt. Please he me how to write the shell script.
# 5  
Old 03-20-2015
Quote:
Originally Posted by springs
Hi have two date and format is yyyy-mm-dd
start_dt and end_dt. I need to find the difference and fetch the dates in between start_dt and end_dt. Please he me how to write the shell script.
Moderator's Comments:
Mod Comment This is not at all related to the current thread topic. Please start a new thread for this discussion instead of hijacking this thread.
# 6  
Old 03-21-2015
Sorry new to this group..no idea and wondering where to post new thread . I do not see such option in my screen. any help is greatly appreciated.
Txns Divu
# 7  
Old 03-21-2015
Quote:
Originally Posted by springs
Sorry new to this group..no idea and wondering where to post new thread . I do not see such option in my screen. any help is greatly appreciated.
Txns Divu
Moderator's Comments:
Mod Comment For everyone except springs, I apologize for the continued noise in this thread that should have been handled by private messages. Apparently, springs is not reading e-mail sent to the address used when this account was created more than seven years ago.


Hello springs,
You joined the UNIX and Linux Forums October 2, 2007... That doesn't really match with "new to this group". It also looks like you have tried to hijack a couple of other threads in the past, but weren't given infractions. (You also did not receive any responses to those posts. If you had started new threads then, you would have been much more likely to get a response.)

Look at the private mail that was sent to you yesterday when you received the infraction for hijacking this thread. It provided complete instructions describing how to post in the forums as shown below:
Quote:
Hello and Welcome to The UNIX and Linux Forums!

Please read our FAQ on how to post new threads in the forums.

As a registered user you can go to any forum where you have permission to post and create new threads, view threads and leave replies. You should always search the forums before posting a new thread (Google Site Search).

To create a new thread, click on a forum you would like to post in, for example, UNIX for Dummies Questions & Answers, and then click on the new thread icon Image

To reply you have a few options. You can click on the 'Post Reply' button Image and add a new post to the end of the thread. Alternatively, you can leave a quick reply in a quick editor box listed below the posts in the thread.

If you have further questions on forum operations, do not send email or private messages (PMs) to us. You are required to post these questions here:

Post Here to Contact Site Administrators and Moderators

Enjoy, Learn and Teach!

The UNIX and Linux Forums
Note that you can click on any of the underlined text above to open a page in your browser related to that text.

Please also review the forum rules.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed working on command line but file unchanged when execute with Shell script

I have a simple task to replace unix line feed end of line characters with carriage returns. When I run the following “change file in place” sed instruction from the command line all the Line feeds are successfully replaced with Carriage returns. sed -i 's/$/\r/' lf_file.txt But that same... (1 Reply)
Discussion started by: hawkman2k
1 Replies

2. Shell Programming and Scripting

How to execute application commands with shell script?

Hi Friends, We have a application "getstatus" which needs to run on application prompt. But it is not working with shell script. Example: Unix Root Prompt# execute "crp" to go to application prompt CRP>getstatus displays output of app health CRP>exit Unix Root Prompt# Script , which... (2 Replies)
Discussion started by: suresh3566
2 Replies

3. Shell Programming and Scripting

Need to execute Oracle relocation command in shell script

Hello, I need to execute below command in shell script srvctl relocate service -d $database -s $service -i $avail -t $pref -f and also need to get the errors ,if any,in another file. What's the right way to execute such commands in shell script? Best regards, Vishal (1 Reply)
Discussion started by: Vishal_dba
1 Replies

4. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

5. UNIX for Dummies Questions & Answers

How to execute command after telneting in shell script?

Hi , I have to write a shell script to telnet to specific host and execute the admin command there. Please help me to do that. Eg : telnet hostname portno admin command exit (3 Replies)
Discussion started by: arukuku
3 Replies

6. UNIX for Dummies Questions & Answers

ssh command to execute shell script in another server

ssh -q <hostname> /opt/tcs/satish/tst.ksh ssh -q <anotherserver> /opt/tcs/satish/tst.ksh tst.ksh has "nohup <command> & " when i execute below script , its throwing error as nohup can not be found ssh -q <anotherserver> /opt/tcs/satish/tst.ksh > log & can someone let me... (5 Replies)
Discussion started by: only4satish
5 Replies

7. Shell Programming and Scripting

root user command in shell script execute as normal user

Hi All I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh URL="www.google.com" VBURL="10.5.2.211" echo "Setting route for $URL for GPRS" URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1` echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies

8. Shell Programming and Scripting

Execute a shell script after a particular command is run

Hi, I need to run a script whenever the Cron file is modified. The requirement is whenever a user modifies the cron file, the script should run automatically. Can you please provide your inputs ? (5 Replies)
Discussion started by: harneet2004us
5 Replies

9. Shell Programming and Scripting

write a shell script to execute a command

Hello all, I have just started doing shell scripting. I want to read a file which stores the status of my job I have submitted on a cluster. The file looks something like this : ========================FILE============================= crab: Checking the status of all jobs: please wait... (4 Replies)
Discussion started by: learn_linux
4 Replies

10. Shell Programming and Scripting

shell script to execute user command

I don't know why the following shell script doesn't work. Could you please help me out? #!/usr/bin/ksh test="cal > /tmp/tmp.txt 2>&1" $test I know it will work for the following format: #!/usr/bin/ksh cal > /tmp/tmp.txt 2>&1 However, I need to get the command from the user in... (1 Reply)
Discussion started by: redtiger
1 Replies
Login or Register to Ask a Question