Sponsored Content
Top Forums Shell Programming and Scripting Unix Shell basic loop massive n00b Post 302552115 by thurft on Thursday 1st of September 2011 04:10:50 PM
Old 09-01-2011
Quote:
Originally Posted by Corona688
Check that the length is three. [ "${#STR}" -eq 3 ]

Check that it's all digits. [ -z "${STR/[0-9]*/}" ]

Check that it's not in the file. ! grep $ID user.db #??? not perfect but best I can do without knowing what user.db looks like

So

Code:
STR=""
until [ "${#STR}" -eq 3 ] && [ -z "${STR/[0-9]*/}" ] && ! grep "$STR" user.db > /dev/null
do
         read STR
done

Thank you!!

I really appreciate that you took the time to help me out Smilie

However, how do I tell the user then why they are re inserting the information then?
specially if the entry is already in the user.db
coz that code will do it over and over again until is right but the person will not know why they have to re enter the info

Thank you again!
u r a life saver!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Absolute n00b questions about Unix / Linux

Hi All, I have absolutely no experince with either one, and would LOVE to start from somewhere! So please guide me to some web sites (beside these great forums of course!) that I can obtain n00b information. (Books, links, resources, etc.) What software OS? should I begin with? I have heard... (2 Replies)
Discussion started by: CodeHunter
2 Replies

2. UNIX for Dummies Questions & Answers

A basic question of FOR loop

Hi, have a basic query. Please see the below code: list="one two three" for var in $list ; do echo $var list="nolist" Done Wht if I want to print only first/ last line in the list Eg one & three Regards er_ashu (3 Replies)
Discussion started by: er_ashu
3 Replies

3. Shell Programming and Scripting

unix shell basic

need some help badly. if i had a file with content of few lines like the followings. 1183724770.651 0.049 137.157.56.169 200 415 GET http://venus/client/clients.xml "text/xml" 1183724770.651 0.049 141.183.101.250 200 415 GET http://venus/client/clients.xml "text/xml" using what command... (1 Reply)
Discussion started by: akagi07
1 Replies

4. Programming

Creating a basic UNIX shell script for chatting

Hey guys, This is quite simply what I'm trying to make: A program that runs in a UNIX terminal that you can output text messages to from another machine. These text messages would be prepended with a customized prompt. I'd also like to have the window spew out random dumps of flavor text not... (1 Reply)
Discussion started by: AcerAspirant
1 Replies

5. Shell Programming and Scripting

Shell Scripting n00b

Hey Guys! I was hoping for some help with a simple script I'm trying to use. I have the script set up to pull some simple information out of a database .txt file and sed it into a preexisting template for assignment cover letters. The problem seems to be someplace in the sed statement but I... (5 Replies)
Discussion started by: BFeicht
5 Replies

6. Shell Programming and Scripting

Help required on basic Unix Bourne Shell Script

Howdy People :), I'm a newbie & its my first question here. I've started learning Unix Bourne Shell scripting recently and struggling already :p Can someone PLEASE help me with the following problem. Somehow my script is not working. Display an initial prompt of the form: Welcome to... (1 Reply)
Discussion started by: methopoth
1 Replies

7. Shell Programming and Scripting

which is the Very basic certification on unix shell scripting?

Hi, I am very new to this forum, can any one tell me which is the very basic certification on unix shell scripting? please give me an advice on this. (1 Reply)
Discussion started by: Manjesh
1 Replies

8. Shell Programming and Scripting

Shell pipeline help for a n00b

I need to read input from a file, and make sure nothing prints after column 72. basically, ignore input after character 72 until the next newline character. Any help is appreciated. I have been searching forever! (10 Replies)
Discussion started by: Gbear
10 Replies

9. UNIX for Dummies Questions & Answers

Basic loop awk/shell script question..

Hi, Sorry if this is a newbie question. I guess you can use either awk or shell script for this sequence of operations, but knowing very little about either of them I'm not sure how I should try to write this. The basic objective is to copy certain files that are scattered all over my... (10 Replies)
Discussion started by: pc2001
10 Replies

10. Shell Programming and Scripting

Basic FOR loop with break

Oracle Linux : 6.4/bash shell In the below I want to break out of the loop when it enters the 5th iteration. #!/bin/bash for i in 1 2 3 4 5 6 do echo "$i" if echo "Oh Nooo... i = $i. I need to stop the iteration and jump out of the loop" then break fi done But, it only... (3 Replies)
Discussion started by: John K
3 Replies
gozer(1)						      General Commands Manual							  gozer(1)

NAME
gozer - a commandline text renderer SYNOPSIS
gozer [options] [file] DESCRIPTION
gozer is a commandline text rendering utility for creating images from abitrary text in antialised truetype fonts using optional fontstyles, wordwrapping and layout control. gozer uses the imlib2 library to create and save images. gozer has a few options, detailed below. Specify [file] as the filename to save the rendered text to. Options can also be specified in an rc file , allowing you to save com- monly used options (such as fontpaths) for reuse. The rc file $HOME/.gozerrc is always parsed for default settings, and other rc files can be specified on the commandline to override these options. See RC FILES for information on syntax. OPTIONS
-h, --help display help output and exit. -v, --version output version information and exit. -b, --background COL use COL as the background color, see COLOUR_DEFINITIONS for syntax, default is transparent (0,0,0,0). -f, --foreground COL use COL as the foreground color. Default is white (255,255,255,255). -F, --font STR draw using font STR. Size is specified with the name, eg 'arial/12' for 12pt arial, default is 20thcent/16 (a font supplied by gozer). -j, --justification STR justify text, allowed values for STR are left, right, center or block. Default is left. -l, --line-spacing INT separate multiple lines by INT pixels, default 1. -p, --fontpath STR colon seperated list of font directories to search for fonts in. Best used in the RCFILE to save typing it each time. -q, --quality INT 1-100, effects quality of output for certain formats, e.g. jpeg compression (higher means higher quality). -P, --pipe Pipe input text from standard in instead of reading it from a file. -r, --rc-file STR use STR as the rc file to look for extra options, default is $HOME/.gozerrc -s, --style STR use STR as a file to load a fontstyle from, see FONTSTYLES for syntax. -t, --text STR use STR as text to draw. -T, --textfile STR read text to draw from file STR. -w, --wrap INT wordwrap the text to INT pixels. -x, --x-offset INT Offset text horizontally from top left by INT pixels. -y, --y-offset INT Offset text vertically from top left by INT pixels. RC FILES
rc file syntax is simple. The '#' character at the start of a line denotes that the line is a comment, otherwise lines are started with the name of a long option from the commandline (without prefixing the --), some whitespace and the value of the option. E.g. fontpath /usr/share/truetype:/usr/local/share/truetype NOTE that options in a --rc-file specified rc file OVERRIDE those from the commandline, but the $HOME/.gozerrc file is always read first for default settings. COLOUR_DEFINITIONS You can define colours in 4 ways. Using the html style: #RRGGBB (in which case alpha defaults to 255), #RRGGBBAA, or an alternative style: r,g,b or r,g,b,a (no spaces between commas please). eg for white text, either use #ffffff, #ffffffff, "255,255,255" or "255,255,255,255". For red, #ff0000, #ff0000ff or "255,0,0" etc. FONTSTYLES
fontstyles can be defined in the EFM syntax (for compatibility only, these are not as powerful), or the recommended syntax defined here. The first line contains the line: #Style The second, an optional style name, #NAME mystyle There follows a list of layers. Each is described by this rule: RED GREEN BLUE ALPHA X_OFFSET Y_OFFSET The special values or 0,0,0,0 for red, green, blue and alpha specify the positioning of the actual text in it's selected colour. For example, the following style defines a very simple shadow for text: #Style #NAME shadow 0 0 0 128 -3 -3 0 0 0 0 0 0 BUGS
None known. LICENSE
Copyright Tom Gilbert 2000 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies of the Software, its documentation and marketing & publicity materials, and acknowledgment shall be given in the documentation, materials and software packages that this Software was used. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MER- CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Email bugs and feature requests to <gozer_sucks@linuxbrit.co.uk> Oct 26, 2000 gozer(1)
All times are GMT -4. The time now is 10:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy