pause needed for corn shell


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers pause needed for corn shell
# 1  
Old 12-08-2007
Question pause needed for corn shell

I need a user pause for a script file, like the pause command in dos. please help I thought it was the corn shell it is csh.

Last edited by dennysavard; 12-08-2007 at 08:41 PM..
# 2  
Old 12-08-2007
It called the korn shell. How about this...

Code:
#! /usr/bin/ksh

function pause
{
typeset savesetting result
print -n "Hit any key to continue..."
savesetting=$(stty -g)
stty -icanon min 1 time 0
result=$(dd bs=1 count=1 2>/dev/null)
stty "$savesetting"
echo
}



echo one
pause
echo two
exit 0

# 3  
Old 12-08-2007
The following is one way of doing it

Code:
read prompt?'Press any key to continue .....'

# 4  
Old 12-08-2007
you can 'sleep' for specified amount of time as well,
"man sleep" for details.
# 5  
Old 12-09-2007
@perderabo

can u explain little bit of the pause function u have written.
# 6  
Old 12-09-2007
It displays:
Hit any key to continue...
then it waits until the user types a key. I looked up the pause command and the docs said that this is what it does. And I just noticed that the OP has edited his first post and now says this is csh. Well sorry, but I'm not a csh guy.
# 7  
Old 12-09-2007
Try this

Code:
#!/bin/csh
/bin/echo "Press any key to continue .....\c"
set dummy = $<

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pause before exit

6) printf "\n GoodBye! \n\n"; exit ;; I am trying modify the above command to pause a couple of seconds before exiting, so a message can be displayed. Thank you :). (8 Replies)
Discussion started by: cmccabe
8 Replies

2. UNIX for Dummies Questions & Answers

Schedule a corn job

Hi, I new to cron job... I need to schedule a job that runs on a particular day at a specific time say for example need to send a test mail at around 2:30PM on wed 10th August i have used the below syntax, but the job was not executed. 30 14 * * * echo "message from UNIX... (3 Replies)
Discussion started by: ch33ry
3 Replies

3. Shell Programming and Scripting

Pause shell script till folder doesn't change size anymore

Hi, I recently would like to write a shell script that 1. Runs in the background (can be done with "&", but i'd be happy for other solutions to keep programs running) 2. Does its stuff 3 THEN checks a specified folder for a size change over time (say, each 5 seconds. AND ONLY continues with... (9 Replies)
Discussion started by: pasc
9 Replies

4. Shell Programming and Scripting

Sort output is different with Corn

Hi, I am sorting a file, but getting different output with crontab. input file-file z Z x X y Y when I sort manually sort file x X y Y z Z (4 Replies)
Discussion started by: suresh3566
4 Replies

5. Shell Programming and Scripting

How to pause a shell script

Hi, I've written a shell script to take photos with my camera. After every picture taken, the picture is transmitted to the computer via usb and then deleted on the camera. But sometimes there's an error and the picture is not deleted and so, after a certain time, the camera chip will be... (4 Replies)
Discussion started by: McLennon
4 Replies

6. Shell Programming and Scripting

Newbie question-do I pause and exec my shell scripts?

Hi there, I'm writing a script to restore 3 directories and 3 mysql db's every 24 hours. While writing the script, I came across the thought... Do I need to pause between executions? Example: msql restore1.sql rm -Rf path1/* cp -Rf path1/* /restore1 chmod 777 /folder1/cache1 ... (2 Replies)
Discussion started by: semiotics101
2 Replies

7. UNIX for Dummies Questions & Answers

pause() problems

well is gets stuck and i dont know why....... pid=fork(); if(pid==0) { pause(); write(1,"child",5); exit(0); } else { sleep(1); kill(pid,SIGCONT); write(1,"parent",5); wait(0); } all=1; (1 Reply)
Discussion started by: IdleProc
1 Replies

8. Shell Programming and Scripting

the shell not pause when execute read command

Hi, i facing a problem when run the script below.. while do if then printf "Please enter a name : " read response # the problem occur here if then ea_ident=${omc_ident} else # # Check that name does not contain invalid... (14 Replies)
Discussion started by: neruppu
14 Replies

9. UNIX for Dummies Questions & Answers

CORN job

Hello, How can i check? How many corn jobs are running? Thanks Raghu.K (1 Reply)
Discussion started by: raghuk2
1 Replies

10. UNIX for Dummies Questions & Answers

how to pause another process?

I guess I posted in wrong forum before. How do I pause another process and then restart it on linux? The other process doesn't listen for anything. Thanks for any help you can offer. Dane :confused: (1 Reply)
Discussion started by: daneensign
1 Replies
Login or Register to Ask a Question