The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
CORN job raghuk2 UNIX for Dummies Questions & Answers 1 05-17-2006 10:37 PM
pause? where art thou? 01000101 High Level Programming 3 05-15-2006 07:42 PM
how to pause another process? daneensign UNIX for Dummies Questions & Answers 1 02-14-2006 12:27 AM
K Shell Help needed stevefox Shell Programming and Scripting 2 02-01-2006 05:57 AM
Shell help needed stevefox Shell Programming and Scripting 11 11-28-2005 12:49 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-08-2007
dennysavard dennysavard is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 2
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 (permalink)  
Old 12-08-2007
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
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 (permalink)  
Old 12-08-2007
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,913
The following is one way of doing it

Code:
read prompt?'Press any key to continue .....'
  #4 (permalink)  
Old 12-08-2007
benlutgens benlutgens is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 9
you can 'sleep' for specified amount of time as well,
"man sleep" for details.
  #5 (permalink)  
Old 12-09-2007
zedex zedex is offline
Registered User
  
 

Join Date: Feb 2007
Location: india,mumbai
Posts: 138
@perderabo

can u explain little bit of the pause function u have written.
  #6 (permalink)  
Old 12-09-2007
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
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 (permalink)  
Old 12-09-2007
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,913
Try this

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

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:08 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0