Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Noob question: How to check the total number of inputs entered by user? Post 303042045 by jejemonx on Thursday 12th of December 2019 04:34:33 AM
Old 12-12-2019
I'm using the
Code:
read

command to read 3 inputs, namely num1, num2, and num3. I want to write a while loop that repeatedly asks for the correct number of inputs, which is 3.

Here's the pseudocode:
read user input here (must be 3)
while the number of inputs entered is less than or greater than 3, ask again for input.
Once it exits the while loop, do the rest of the script's purpose.

Last edited by rbatte1; 12-12-2019 at 10:10 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash : how do i check the user input and make sure is only chracter or only number ?

Bash : how do i check the user input and make sure is only character or only number ? (7 Replies)
Discussion started by: CheeSen
7 Replies

2. Shell Programming and Scripting

validating user entered date

I need the date validation. I searched in the google but i didn't find my requirements. requirements: 1) user has to enter the date in YYYY/MM/DD format 2) MM validations 3) DD validations. and if the month is april it should allow 30 days only and for May month it should allow 31 days like... (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

3. High Performance Computing

PBS - restrict total number of processors per user

Hello everyone! I am a bit inexperienced with administering queueing programs. I installed Torque (a PBS derivative) on a Linux cluster and it is running well. There is one annoying problem though: users can run massively parallel jobs and serial jobs too. Almost all users do a mix of the two. I... (0 Replies)
Discussion started by: gnuplot
0 Replies

4. Shell Programming and Scripting

Total noob script

Hi i am a total noob at shell scripting. i was wondering if somebody could help me with my script. i want the script to search the dev folder for the burner file because they are different between distrubutions? as i under stand it. this i the script. #!/bin/bash echo "Script för att bränna 360... (4 Replies)
Discussion started by: MatsO
4 Replies

5. Shell Programming and Scripting

only a number can be entered no letters?

ok the user can only enter a number if a letter is entered it shouldnt be accepted This is what i have so far read -p "How many cars to enter:" cars until do read -p "Invalid number. Please re-enter:" $tags done (5 Replies)
Discussion started by: gangsta
5 Replies

6. Shell Programming and Scripting

Help with sum total number of record and total number of record problem asking

Input file SFSQW 5192.56 HNRNPK 611.486 QEQW 1202.15 ASDR 568.627 QWET 6382.11 SFSQW 4386.3 HNRNPK 100 SFSQW 500 Desired output file SFSQW 10078.86 3 QWET 6382.11 1 QEQW 1202.15 1 HNRNPK 711.49 2 ASDR 568.63 1 The way I tried: (2 Replies)
Discussion started by: patrick87
2 Replies

7. Shell Programming and Scripting

How to accept command line argument as character or text if number is entered?

Hello Does the unix korn shell provide a function to convert number entered in command line argument to text or Character so that in next step i will convert Chr to Hex (6 Replies)
Discussion started by: aadityapatel198
6 Replies

8. Shell Programming and Scripting

Print Unknown Number of User Inputs in awk

Hello, I am new to awk and I am trying to figure out how to print an output based on user input. For example: ubuntu:~/scripts$ steps="step1, step2, step3" ubuntu:~/scripts$ echo $steps step1, step2, step3 I am playing around and I got this pattern that I want: ... (3 Replies)
Discussion started by: tattoostreet
3 Replies

9. Shell Programming and Scripting

How to check user entered correct file format or not?

Hi Experts, path=/db/files/ format=$1 User can enter any file format.compare the user file format with actual file format existed in the directory /db/files. User enter all characters as "A" apart from date format. example1: user will be entering the file format AAA_AA_YYYYMMDD.AAA Actual... (6 Replies)
Discussion started by: nalu
6 Replies

10. Shell Programming and Scripting

Total Noob BASH scripting question

Hello All, I have a file of ip addresses called activeips.txt What I'm trying to do is run a simple bash script that has a loop in it. The loop is a cat of the IP addresses in the file. The goal is to run 2 nmap commands to give me outputs where each address in the list has an OS... (11 Replies)
Discussion started by: Dirk_Pitt
11 Replies
UNCRUSTIFY(1)							   User Commands						     UNCRUSTIFY(1)

NAME
uncrustify - C, C++, C#, D, Java and Pawn source code beautifier SYNOPSIS
uncrustify [OPTIONS] [FILES] DESCRIPTION
If no input files are specified, the input is read from stdin. If reading from stdin, you should specify the language using -l. If -F is used or files are specified on the command line, the output filename is PFX + "/" + filename + SFX. Unless, of course, the options --replace or --no-backup are used. When reading from stdin or doing a single file via the '-f' option, the output is dumped to stdout, unless redirected with -o FILE. Errors are always dumped to stderr OPTIONS
Basic Options: -c CFG Use the config file CFG. If not specified, uncrustify will use $UNCRUSTIFY_CONFIG or $HOME.uncrustify.cfg. -f FILE Process the single file FILE, sending output to stdout or the file specified with -o. -o FILE Redirect output to FILE. Use with -f, --update-config, --update-config-with-doc, --universalindent. -F FILE Read files to process from FILE, one filename per line. You can create this file using something like 'find . -name "*.c" > list.txt'. This cannot be combined with -f. --prefix PFX Prepend PFX to the output filename path. This cannot be combined with -f, --replace, or --no-backup. --suffix SFX Append SFX to the output filename. The default is '.uncrustify' if neither SFX or PFX are specified. This cannot be combined with -f, --replace, or --no-backup. --frag Assume the input is a code fragment and the first line is properly indented. --replace Replace source files (creates a backup). This cannot be combined with -f, --prefix, or --suffix. --no-backup Replace files, no backup. Useful if files are under source control This cannot be combined with -f, --prefix, or --suffix. --mtime Preserve mtime on replaced files. -l Language override: C, CPP, D, CS, JAVA, PAWN, VALA, OC, OC+ -t Load a file with types (usually not needed) -q Quiet mode - no output on stderr (-L will override) Config/Help Options: -h -? --help --usage Print this message and exit --version Print the version and exit --show-config Print out option documentation and exit --update-config Output a new config file. --update-config-with-doc Output a new config file with embedded usage comments. --universalindent Output a config file for Universal Indent GUI. --detect Detects the config from a source file. Use with '-f FILE'. Detection is currently fairly limited. Debug Options: -p FILE Dump debug info to a file -L SEV Set the log severity (see log_levels.h) -s Show the log severity in the logs --decode FLAG Print FLAG as text and exit EXAMPLES
Read a D file from stdin, output to stdout. cat foo.d | uncrustify -q -c my.cfg -l d Process a file, output to stdout. uncrustify -c my.cfg -d foo.d Process a source tree, output to a different tree. find src -name "*.[ch]" > files.txt uncrustify -c my.cfg -F files.txt --prefix out Process a source tree in-place. uncrustify -c my.cfg --no-backup $(find src -name "*.[ch]") NOTES
Use comments containing ' *INDENT-OFF*' and ' *INDENT-ON*' to disable processing of parts of the source file. AUTHOR
Written by Ben Gardner REPORTING BUGS
Use the issue tracker at <http://sourceforge.net/projects/uncrustify> COPYRIGHT
Copyright (C) 2006-2009 Ben Gardner LICENSE
GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. uncrustify 0.59 Oct 2009 UNCRUSTIFY(1)
All times are GMT -4. The time now is 03:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy