![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| read a variable character by character, substitute characters with something else | vipervenom25 | UNIX for Dummies Questions & Answers | 2 | 06-06-2008 03:18 PM |
| Sed a variable which has - character in it | potro | Shell Programming and Scripting | 6 | 03-14-2008 05:24 AM |
| hw can i count the number of character in a file by perl | trupti_rinku | Shell Programming and Scripting | 1 | 10-31-2006 07:27 AM |
| Sed character number specification | mvalonso | UNIX for Dummies Questions & Answers | 4 | 05-10-2006 10:32 AM |
| Number or Character | j1yant | Shell Programming and Scripting | 3 | 02-10-2003 02:08 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
defining a variable as a number or character?
I am writing a script that needs to accept numbers into a variable by prompting and using the code
read num case $num in 000) break ;; *) I am fairly new to unix and am loving the versatility of the language but need a little shove in the right direction. I know how to define variables in C++, but how do you make sure that a variable is a number? And if a character string is entered instead of a number is there any way that i could send an error message and start the loop again. thank you in advance |
|
||||
|
Code:
#!/bin/ksh # define num as integer and set to zero typeset -i num=0 |
| Sponsored Links | ||
|
|