12-12-2019
So your one-liner will not help you if you have more than 3, as it will not take account or will all be in num3, and if someone enters:
1,23,45 you are stuck too...
If you continue with your one-liner read, you will need num4 to be able to check more than 3 numbers were entered, after it does not matter...and you will have to check if you have a valid value in num 1-3 as what is stopping someone to enter "A"?
And while you don't have your 3 numerics in num1-3, you reinitialize your variable to 0 and start again...
---
wisecracker has also shown you what I had in mind and his suggestion solves partially your issue, only this more easy design looks like it is not an option here, as this seems more to be homework to see how smart you are to sort yourself out of this tricky issue when using in such manner the read command...
And so unless you can justify this is not homework and as such should have been posted in the adequate room and following the special rules there I will close this thread
Last edited by vbe; 12-12-2019 at 11:59 AM..
Reason: typos
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 character or only number ? (7 Replies)
Discussion started by: CheeSen
7 Replies
2. Shell Programming and Scripting
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
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
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
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
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
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
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
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
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
LEARN ABOUT OPENSOLARIS
auditstat
auditstat(1M) System Administration Commands auditstat(1M)
NAME
auditstat - display kernel audit statistics
SYNOPSIS
auditstat [-c count] [-h numlines] [-i interval] [-n] [-v]
DESCRIPTION
auditstat displays kernel audit statistics. The fields displayed are as follows:
aud The total number of audit records processed by the audit(2) system call.
ctl This field is obsolete.
drop The total number of audit records that have been dropped. Records are dropped according to the kernel audit policy. See auditon(2),
AUDIT_CNT policy for details.
enq The total number of audit records put on the kernel audit queue.
gen The total number of audit records that have been constructed (not the number written).
kern The total number of audit records produced by user processes (as a result of system calls).
mem The total number of Kbytes of memory currently in use by the kernel audit module.
nona The total number of non-attributable audit records that have been constructed. These are audit records that are not attributable to
any particular user.
rblk The total number of times that the audit queue has blocked waiting to process audit data.
tot The total number of Kbytes of audit data written to the audit trail.
wblk The total number of times that user processes blocked on the audit queue at the high water mark.
wrtn The total number of audit records written. The difference between enq and wrtn is the number of outstanding audit records on the
audit queue that have not been written.
OPTIONS
-c count Display the statistics a total of count times. If count is equal to zero, statistics are displayed indefinitely. A time
interval must be specified.
-h numlines Display a header for every numlines of statistics printed. The default is to display the header every 20 lines. If numlines
is equal to zero, the header is never displayed.
-i interval Display the statistics every interval where interval is the number of seconds to sleep between each collection.
-n Display the number of kernel audit events currently configured.
-v Display the version number of the kernel audit module software.
EXIT STATUS
auditstat returns 0 upon success and 1 upon failure.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
auditconfig(1M), praudit(1M), bsmconv(1M), audit(2), auditon(2), attributes(5)
NOTES
The functionality described in this man page is available only if the Basic Security Module (BSM) has been enabled. See bsmconv(1M) for
more information.
SunOS 5.11 11 Feb 2008 auditstat(1M)