Sponsored Content
Top Forums Shell Programming and Scripting How to ask a question to a user in ksh Post 48719 by Perderabo on Monday 15th of March 2004 06:28:32 AM
Old 03-15-2004
You can do stuff like this...

Code:
print -n "Enter your name - "
read name
if [[ -z $name ]] ; then
       print I guess you don\\'t know your name
       name="bozo"
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question about KSH line.

Wondering what this line meant, especially the 2>&1 and ${RUN_DIR} parts: ${RUN_DIR}/<filename> 2>&1 Where <filename> is the location and name of a file. (1 Reply)
Discussion started by: CapsuleCorpJX
1 Replies

2. Shell Programming and Scripting

ksh question, loops

i want to add about 60 printers using a ksh script. i am having trouble though, i am reading the input from the hosts file and using the lpadmin command to add like so: lpadmin -p -v /dev/null -m netstandard -o dest= i want printername and ipaddy to come from the hosts file, i am having... (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

3. Shell Programming and Scripting

A Question On Recursion In Ksh

Hi Folks, I would just like to know how recursion works in ksh or inside a shell in general. I created the following script, but it works(runs recursively) only for 64 times: ---------------- #! /usr/bin/ksh displaymessage() { echo "displaying count: $cnt " echo "wait for 1 second..."... (1 Reply)
Discussion started by: marlonus999
1 Replies

4. Shell Programming and Scripting

Conversion question about ksh

Hi all, New to ksh and had a few questions to see if this is doable in ksh or if I am going to have to call out to a tcl procedure. I have an Ascii file I want to convert to hex then search and remove all hex chars '0A' and then convert back to Ascii. Here is an example of an Ascii file I am... (2 Replies)
Discussion started by: hgjdv
2 Replies

5. UNIX for Dummies Questions & Answers

ksh question

How can I know if my system has ksh feature? #!/usr/bin/ksh Which command we allow me to see? Please advise! (1 Reply)
Discussion started by: bobo
1 Replies

6. Shell Programming and Scripting

ksh if block question

Hi, I am looking at a script, and it contains lines like: if ] ... This is getting me confused. Why do we need $ before (echo $* | egrep -c 'DG')? Why can't we simply have: if ] ... i.e. no $ here before the ()... Thanks. J (3 Replies)
Discussion started by: JamesByars
3 Replies

7. AIX

du not working for user using ksh

Hi, I have a strange problem with a AIX server, user are having problem with using du will in their ksh shell, if they switch to sh or bash there is not problem. root account that are using ksh but have not problem with du. this is the error messages when trying to run du du: can't find... (5 Replies)
Discussion started by: robertngo
5 Replies

8. Shell Programming and Scripting

Question regarding ksh script

Hi all, I have came across the following line in a script and was not able to interpret the meaning despite searching in the web for answer, my guess is that it seems like a comment to me stating if 0 then return else exit ============================ : 0 - 999 .... ........ (3 Replies)
Discussion started by: dwgi32
3 Replies

9. UNIX for Dummies Questions & Answers

Question on using a variable in KSH

Hi all, The below command tries to copy ".tgz" instead of "hello_test.tgz" -- It seems as if the underscore gets in the way. I tried with different ways of using quotes, with no luck, unfortunately...it's probably very simple, but may I ask how this would be done: How would the below be... (3 Replies)
Discussion started by: chatguy
3 Replies

10. Shell Programming and Scripting

ksh prompt yes/no question

I am writing a code like this in KSH . #!/bin/ksh echo is this SQL query ? yes or no read answer case $answer in yes|Yes|y) echo got a positive answer ;; no|n) echo got a 'no' ;; esac Here after ... (2 Replies)
Discussion started by: talashil
2 Replies
PURITY(6)                                                          Games Manual                                                          PURITY(6)

NAME
purity - a general purpose purity test SYNOPSIS
/usr/games/purity [ flags ] [ testname ] DESCRIPTION
Purity is an interactive purity test program with a simple, user interface and datafile format. For each test, questions are printed to the your terminal, and you are prompted for an answer to the current question. At a prompt, these are your choices: y Answer "yes" to the question. n Answer "no" to the question. b Backup one question, if you answered it incorrectly, or someone is watching you take the test, and you don't (or do) want to admit a different answer. r Redraw the current question. q Quit the test, and print the current score. ? Print a help screen for the current prompt. k Kill a section of the test. This skips all the questions of the test until the next subject heading. a Toggle answer mode between real answers and obfuscated answers. Real answers print "yes" and "no", while obfuscated answers are "Maybe" and "maybe". Obfuscated answers are preferred if you are shy, and don't want people to be able to read your answers over your shoulder as you take the test. d Toggle dERanGe output. s Print your current score on the test you are taking. l Toggle score logging. At the end of the test, your score is printed out. For most purity tests, lower scores denote more "experience" of the test material. FLAGS
These are the command line flags for the test. -a Show real answers (i.e. "yes" and "no") instead of obfuscated ones (i.e. "Maybe" and "maybe") as you answer the questions. -d PrINt THe tESt in DerANgeD pRInT. -f Take the test in fast mode. Only the questions are printed, and not any other text blocks, like the introdution, subject headers, and the conclusion. -l Take the test without having your score logged. -p Print the test without prompting for answers. This is useful for making hard copies of the tests without having to edit out the prompts by hand. -r Decrypt the test using the Rot 13 algorithm. This is done as a form of "protection", such that if you read a rot13 test and it offends you, it's your own fault. -z zoom through more prompts in large text blocks. The default is to prompt the user for more when a screenful of text has been printed without any user input. DATAFILE FORMAT
The format of the datafiles is a very simple format, intended such that new tests can quickly and easily be converted to run with the test. There are four types of text in a purity test datafile. Each type is contained in a bracket type of punctuation. The definitions are as follows: the styles of text blocks are: { plain text block } [ subject header ] ( test question ) and < conclusion > Plain text blocks are printed out character for character. Subject headers are preceded by their subject numbers, starting at 1, and then printed as text blocks. Questions are preceded by their numbers, and then prompt the user to answer the question, keeping track of the user's current score. Conclusions first calculate and print the user's score for the test, then print out the conclusion as a text block. If you wish to include any of the various bracket punctuation in your text, the backslash ("") character will escape the next character. To print a question with parentheses, you would use the following format: (have you ever written a purity test (like this one)?) the output would be this: 1. have you ever written a purity test (like this one)? and then it would have asked the user for her/his answer. For a generic datafile, use the "sample" datafile for the test. FILES
/var/games/purity.scores the score logfile /usr/share/games/purity/* test data files AUTHOR
Eric Lechner, lechner@ucscb.ucsc.edu 18 December 1989 PURITY(6)
All times are GMT -4. The time now is 07:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy