10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
To check a bash script syntax without executing it we use:
bash -n scriptname
What should be the equivalent command for checking a ksh script? (8 Replies)
Discussion started by: proactiveaditya
8 Replies
2. Shell Programming and Scripting
I am trying to test to see if the hostname of the computer I'm on starts with ne1dxdb - it can contain any characters after that. I have the following code, but it's not working - it's not falling into the if statement. Any ideas?
boxname="unknown"
function get_hosttype {
... (4 Replies)
Discussion started by: kittsi
4 Replies
3. Shell Programming and Scripting
Hi, I'm trying to check to see that the arguments given to my script are both numeric and positive integers. I'm using tcsh. I figured out the positive part, but I am having trouble with the arguments being numeric and integers
I have no idea where to get started with the checking them actually... (1 Reply)
Discussion started by: mistykz
1 Replies
4. UNIX for Dummies Questions & Answers
I'm trying to test and see whether a variable that is being extracted from a line in a file is numeric or not. I have tried everything that I can think of and I cannot figure out how to get it to work. I am trying to test and see if the string extracted contains 5 numeric digits. This is what I... (8 Replies)
Discussion started by: developncode
8 Replies
5. Shell Programming and Scripting
hi all,
i have a shell (ksh) script where i am reading line by line from a grep command and i wanted to check if the grep command actually returned something or was null. i can do this by using -z :
if ; then .....
but this forces me to do something when $myVariable is null when i... (3 Replies)
Discussion started by: cesarNZ
3 Replies
6. UNIX for Dummies Questions & Answers
How would I go about getting the previous date on the server? I'm out of ideas...I am thinking that I could do it using the date command, but I am unable to find any information on doing it. For example if the current date is April 17th 2008 it would be (20080417) <- (YYYYMMDD). I need the previous... (4 Replies)
Discussion started by: developncode
4 Replies
7. UNIX for Dummies Questions & Answers
How could I check if a numeric variable has 5 digits in KSH...I have a zipcode variable that I know will always be 5 digits, and I want to print out an error if it is less or more than 5 digits the problem is that I have it as:
if ]
but this won't work because the statement doesn't see 0001 as... (3 Replies)
Discussion started by: developncode
3 Replies
8. UNIX for Dummies Questions & Answers
How could I check if a string variable contains at least (or only) 2 characters, and check and make sure that the string does not contain any numeric digits?...I need to know how to do this as simple as possible. and I am using the Ksh shell. Thanks. (1 Reply)
Discussion started by: developncode
1 Replies
9. Shell Programming and Scripting
Hi,
How can I check numeric value in shell?
I am passing one parameter (integer) and I want to restrict any other characters except 0-9.
./script xyz 10
Here 2nd parameter (10) should be integer only.
Can anyone help on this?
Malay (6 Replies)
Discussion started by: malaymaru
6 Replies
10. Shell Programming and Scripting
Quick question related to KSH expressions (not unix regular expressions).
I am trying to craft a pattern that will correctly identify lines that match the following CSV text in a case statement:
filename.txt, filename.txt, alpha, nnnn, nnnn, nnnn, Free form text
Originally I simply used... (4 Replies)
Discussion started by: tmarikle
4 Replies