How to print warning messages on console when we use exec command?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to print warning messages on console when we use exec command?
# 1  
Old 10-31-2013
Error How to print warning messages on console when we use exec command?

I am having script in which for logging I am using exec command. I am calling another script/program through this script which is designed for another user id.

So, After running script it is giving warning message as "This program has been designed for another user id. Please press Enter to continue."
After went through log I understood to finish execution we need to hit enter one more time. But everytime this is not possible.

I want to print this warning message on console so whoever is running script can read the warning message.

Help is much appreciated.Smilie

Thanks,
Vikram.
# 2  
Old 10-31-2013
Try directing the message to /dev/tty.
# 3  
Old 10-31-2013
Thanks For quick reply Scott Smilie

will it work if I am calling program as follows,

Code:
$service_script_Path/stopservers > /dev/tty

Thanks,
Vikram.
# 4  
Old 10-31-2013
No, since any exec or redirection in "stopservers" will override it.
# 5  
Old 10-31-2013
Thanks Scott!

but exec or redirection is not in stopservers program...
let me tell you..
I have one script say abc.ksh in which I am using exec to log the details...
in abc.ksh I am calling /stopservers program which is designed for another user. So, it's throwing warning message as "This program has been designed for another user. Press Enter to continue"

I want to print this error message on console.. So this will work right?

Thanks!
# 6  
Old 10-31-2013
Oh, in that case, it should be OK Smilie
# 7  
Old 10-31-2013
Thanks Scott! SmilieIt works..

Cheers !!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux find command seems to not transmit all the result to the '-exec command'

Hello. From a script, a command for a test is use : find /home/user_install -maxdepth 1 -type f -newer /tmp/000_skel_file_deb ! -newer /tmp/000_skel_file_end -name '.bashrc' -o -name '.profile' -o -name '.gtkrc-2.0' -o -name '.i18n' -o -name '.inputrc' Tha command... (3 Replies)
Discussion started by: jcdole
3 Replies

2. Shell Programming and Scripting

Print info in console or not judged by variable

I have a code fragment #dosomething ( #do many things ) |tee -a zzz.log #dosomething I want a varialbe var if var =1, print the info in (#do many things ) to console, if var=0, not print the info to console (1 Reply)
Discussion started by: yanglei_fage
1 Replies

3. Shell Programming and Scripting

Exec command - what is it doing here?

Hi all, Forgive me for asking for help with my first post, but I am struggling here. I've been asked to translate a bash script into a Windows script (probably batch or powershell, not sure yet), so the first step is obviously understand what the bash script is doing. But I have no experience in... (5 Replies)
Discussion started by: el_foz
5 Replies

4. Shell Programming and Scripting

exec command help

Hi, I have the following lines in a script : . . exec < some_file . . . I have very little idea about exec command. I would like to know what this does and what will happen if the file some_file does not exist. Specifically, I would like to know whether the lines following this... (5 Replies)
Discussion started by: elixir_sinari
5 Replies

5. UNIX for Dummies Questions & Answers

Exec command

Hi can some one explain the following command , It would really help if some can really elloborate on what is happening out here export PATH | exec /bin/sh ./auto_approve :q P.S: This is the first time i am using exec ,so an elloboration what does it do and what is the use of the :q will be... (1 Reply)
Discussion started by: Sri3001
1 Replies

6. Shell Programming and Scripting

exec command

How can I use the exec command to log my korn shell session to the screen and the log file? Currently I have this command: $exec 1> ${LOG} 2>&1 This logs the output to the log file only. I want it to go to the screen also. Is this possible with this command? thanks. (10 Replies)
Discussion started by: djehresmann
10 Replies

7. UNIX for Dummies Questions & Answers

UNIX command to skip any warning messages and continue job execution

Hello All, Good day! This is my first UNIX post. :D Anyways, I would like to seek help from you guys if you know of any UNIX command that will skip a warning message once it is encountered but continue to run the execution. Ok here's the situation in general: An encypted file is sent to... (2 Replies)
Discussion started by: jennah_rekka
2 Replies

8. Shell Programming and Scripting

display warning messages on command line

I have made a script to print size of a slice if it reaches more then 80% which is working fine no problem in it. I want to add this script in crontab to print this message on command line every half hour if slice size reaches more then 80%. here is the line below i added on crontab 30 *... (2 Replies)
Discussion started by: Danish Shakil
2 Replies

9. Shell Programming and Scripting

Print out loop index on the console after executing each sybase DB query

Hello Guys, Well, using shell script, I'm doing loop on DB query as below: isql -Usa -Ptest -I /opt/sybase/interfaces << EOF use testdb go declare @i int select @i = 1 while(@i <= 5) begin Insert into TEST values (@i,"Test","TestDesc") select @i = @i + 1 end go EOF The Issue... (2 Replies)
Discussion started by: Alaeddin
2 Replies

10. Shell Programming and Scripting

exec command

hai i want know the difference between two shell scripts those are 1) a=2004 echo $a #output------2004 exec < inputfile while read line do echo $a #output-------2004 a=2005 echo $line echo $a ... (1 Reply)
Discussion started by: g_s_r_c
1 Replies
Login or Register to Ask a Question