Sponsored Content
Full Discussion: Problems with valid input
Top Forums Shell Programming and Scripting Problems with valid input Post 302355412 by ChrisHoogie on Tuesday 22nd of September 2009 03:33:28 PM
Old 09-22-2009
Problems with valid input

Hello all

I am having problems with a part of my script. Basically it asks for the user to enter a new id number for them. The catches are:-

* It cannot already be existing (it will check a file)
* It has to be four characters
* It can only be numbers
* It cannot call back into the function

The first three parts are simple but not calling itself is causing me problems. I was thinking about using nested while loops and heres what i have got so far. (It feels like i have lost the plot!!)

Code:
read input

while [ $input < 9999 ] 
do
           while [ 'echo $input | wc -c' < 4 ]
           do
                      while [ "$input" = 'grep $input file' ] 
                      do
                      read input
                      done
           read input
           done
read input
done

Any ideas would save me a lot of stress Smilie
 

10 More Discussions You Might Find Interesting

1. Programming

valid code?

hey , everyone. I have a few questions about pieces of code and was wondering if someone could tell me what exactly they did or if they are even valid. bool1 && bool2 || bool3 <---in what order do these get processed? if (! isdigit(c)) <---What does this do? i = j % 3; <---what does this do?... (4 Replies)
Discussion started by: bebop1111116
4 Replies

2. Shell Programming and Scripting

How to check for a valid numeric input

Hi Folks, I'm using bash script. I would like to check whether input is a number or not.(Only positive numbers).. if space or non numeric is entered, it should say "invalid input". pls help.. thanks in adv. Br/// Vijay. (1 Reply)
Discussion started by: Vijayakumarpc
1 Replies

3. Shell Programming and Scripting

Expect script with file input problems

Hello, I am trying to write an expect script that will ssh into a large number of Cisco routers and add some commands via the cli. The script I wrote works great for one host however I have over 350 routers that this needs to be added to. The problem is I cannot get the script to read the file of... (1 Reply)
Discussion started by: meberline
1 Replies

4. Programming

is it valid output ?

#include <iostream> #include<stdio.h> using namespace std; class a { public: int xx; a() { cout << "in CONS a \n"; } ~a() { cout << "in DES a \n"; } }; (1 Reply)
Discussion started by: crackthehit007
1 Replies

5. Shell Programming and Scripting

Specified substitution not valid for

Experts, In a script i get the following error: The specified substitution is not valid for this command Do you have any idea what is wrong with it? TITLE="Code Checker" # Script Titel # EXT="_UA99" # Eind van dirnaam # FILE="job.dat" # Zoekbestandsnaam # SEARCH="returncode 0" #... (1 Reply)
Discussion started by: klaasjan
1 Replies

6. Homework & Coursework Questions

Valid Name

Could someone help me by midnight tonight!!! Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Insert a reference to the Bourne shell as the command... (0 Replies)
Discussion started by: cody007
0 Replies

7. UNIX for Dummies Questions & Answers

Testing for valid DC's?

Ok so this is sort of a unix question. I am frequently logging into customers boxes and our product integrates with Active directory. I deal with a great deal of people who have no business being admins but are and they don't know squat about their network or their DC's. So a recurring problem... (4 Replies)
Discussion started by: MrEddy
4 Replies

8. Shell Programming and Scripting

Valid input compared with input

Hi everyone, I cant seem to figure this out for the life of me. Basically, I have two arrays.. sub init { use Getopt::Long; use Data::Dumper; my @selections = (); my @valid_options = ( "vaild1", "valid2" ); GetOptions( "input=s" =>... (2 Replies)
Discussion started by: ckozler
2 Replies

9. Shell Programming and Scripting

How to get the user input recursively until the user provides valid input

Hi, echo "Enter file name of input file list along with absolute path : " read inputFileList if then for string in `cat inputFileList` do echo $string done else echo " file does not exist" fi From the above code, if the user enters a invalid file... (1 Reply)
Discussion started by: i.srini89
1 Replies

10. Shell Programming and Scripting

How to check the user input to be valid using shell script?

How to check the user input to be valid using shell script? The valid input is in the format like as follows. 1. It can only have r,w,x or a hyphen and nothing else. 2. ensure the r, w, x are in the correct order. for example: rwxr-xr-x is a valid format. Thanks (5 Replies)
Discussion started by: hyeewang
5 Replies
X11META(1)						      General Commands Manual							X11META(1)

NAME
x11meta - output metafile graphics to X11 SYNOPSIS
x11meta [ -c | -r ] file .. DESCRIPTION
X11meta reads each metafile file in sequence and sends it to the default X window system. If the option c is specified, the input files are only conditioned for output, ie. expanded and sorted (see pexpand and psort). If the option r is instead specified, the input is assumed already to be conditioned. If no input files are specified, the standard input is read. -c Condition the input only. -r Input is already conditioned, output only. EXAMPLE
To plot the chart example.bar: bgraph example.plt | x11meta FILES
see pexpand(1) and psort(1) AUTHOR
Greg Ward SEE ALSO
bgraph(1), cv(1), igraph(1), meta2bmp(1), meta2tga(1), metafile(5), pexpand(1), psmeta(1), psort(1) X11META(1)
All times are GMT -4. The time now is 05:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy