back to prompt


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting back to prompt
# 1  
Old 03-21-2012
back to prompt

Hello,

I wrote a script that will be run in background and echo some status information from time to time.
after the loop and output I want to get back to prompt automatically.
currently I have to press return to see prompt again. is this possible to do?
# 2  
Old 03-21-2012
can you write contents of script here?
# 3  
Old 03-21-2012
Code:
#!/bin/bash
loopy=1
while [ "$loopy" -eq 1 ]
do
  cnt=0
  $( [ create logfile ] )
  while read logline
  do
    chk=$( less $log | grep $logline )
    if [ "$chk" == "" ];then
      echo "change: " $logline
      cnt=`expr $cnt + 1`
    fi
  done < $logfile
  sleep x
  cp $logfile $log
  if [ "$1" == "" ];then
    break
  fi
  [ back to prompt please ]
done
if [ "$cnt" -gt 0 ]; then
  cp $log $bklog
fi

# 4  
Old 03-21-2012
you want to exit script in while ,it is true ?
yo can try add "exit" in if loop instead of "break"
# 5  
Old 03-21-2012
Quote:
Originally Posted by ygemici
you want to exit script in while ,it is true ?
no, the loop should go on - but -
after calling 'echo' the prompt in shell I'm working in is gone.
if I type 'return' prompt is back. possible to send this keycode from inside of the script?
# 6  
Old 03-21-2012
What are you typing to run this script?

Where does the value of $log and $logline and $1 come from ?

What is the script intended to do? It contains too many issues to guess.
# 7  
Old 03-21-2012
Quote:
Originally Posted by methyl
What are you typing to run this script?
cko 1 & to run in background with endless loop (without 1st parameter to run just 1 time)

Quote:
Where does the value of $log and $logline and $1 come from ?
oh, sorry - didn't put the whole script in here. logvariables are defined - filenames

Quote:
What is the script intended to do?
script creates "image" of something and stores it in $log on 1st run.
inside of the loop new image is created to $logfile and "compared" to previously created one.
changes should immediately printed out with 'echo' (maybe security issues).
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

Unable to move from rsc prompt to ok prompt

Hi, on sunfire v890 unable to move from rsc prompt to ok prompt, i have executed the command break. (9 Replies)
Discussion started by: manoj.solaris
9 Replies

2. UNIX for Dummies Questions & Answers

How to Change the % prompt to - prompt in UNIX?

how to Change the % prompt to - prompt in unix :wall: ---------- Post updated at 07:40 AM ---------- Previous update was at 07:38 AM ---------- How To display the last modification time of any file in unix ---------- Post updated at 07:40 AM ---------- Previous update was at 07:40 AM... (2 Replies)
Discussion started by: manjiri sawant
2 Replies

3. UNIX for Dummies Questions & Answers

Reset prompt back to "-bash-3.00$"

Can anyone tell me how to reset the command prompt back to the original 'bas'h prompt as these have all been changed via the /etc/profile to add username and hostname but some are too long. I just want to run it in a local .profile to put it back. Thanks (2 Replies)
Discussion started by: skewbie
2 Replies

4. IP Networking

Back-to-Back Connection using HBAs

Hi every body, Is it possible to connect two servers Back-to-Back (Point-to-Point) using HBA adapters & using Fiber. Note it is direct connection & there is no switches between the servers. I'm concern about using HBA adapters, it is possible or not. Thanks in advance. :) (3 Replies)
Discussion started by: aldowsary
3 Replies

5. AIX

back to back printing in UNIX

Hi , Can you suggest me how to back to back printing in UNIX? Is there any way? Kindly advise. Regards Vijaya Amirtha Raj (3 Replies)
Discussion started by: amirthraj_12
3 Replies

6. UNIX for Dummies Questions & Answers

How can I tell why my V120 is back at ok prompt?

I have a problem with a development Sun V120 platform. I will come back to it and sporadically find it's back at the ok prompt. :mad: There are no core dumps and I've had a look at /var/adm/messages and this hasn't really helped. Can someone give me some pointers on where else to look, or how... (5 Replies)
Discussion started by: mattd
5 Replies

7. Shell Programming and Scripting

back up

hi all i need to transfer files from one server to another,but i have to make up a backup with a datestamp on the destination server beore i move the new files from the source to the destination server. example source server destination server a.sun a.sun b.sun ... (0 Replies)
Discussion started by: bkan77
0 Replies

8. HP-UX

Help about back up

Hi this is Ramana.sv new to this group, please help me about my question, i am using HP-UX11.11i with oracle 10G this server is in india and i have another server in US with same HP-UX with oracle10G, what i want is i want to rename the local database in local HP server and copy the database from... (0 Replies)
Discussion started by: mcseramana
0 Replies
Login or Register to Ask a Question