Sponsored Content
Top Forums Shell Programming and Scripting To verify whether the year has all the digits Post 302329131 by rak007 on Friday 26th of June 2009 03:04:39 AM
Old 06-26-2009
^^
This is what i did
Code:
year='2009'
echo year is $year
if [[ ! -z `echo $year | tr -d '[0-9]'` ]]
then
echo 'year in error'
fi
echo end of program

But i got this error

Code:
t1.sh: [[: not found

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Verify Parameters

I have a unix script written in the korn shell. At the top of the script I call a script that exports the values of the variables I use in my script. I know that when you execute the script using ksh -x it shows you the script running. I was wondering if there was a way you could run the script... (2 Replies)
Discussion started by: lesstjm
2 Replies

2. Shell Programming and Scripting

verify arguments

thanks for your help, im gonna skip this one and try a different question. thanks for your help though. (2 Replies)
Discussion started by: bebop1111116
2 Replies

3. Shell Programming and Scripting

total last digits

hi group, How can I count total number of 5's which are continuous in the end. i.e. in the below string, the o/p should be 4 I just know to calculate total number of 5's $ echo "95952325555" | awk -F "5" '{print NF-1}' 6 (3 Replies)
Discussion started by: uwork72
3 Replies

4. Shell Programming and Scripting

help: single digits inflated to 2 digits

Hi Folks Probably an easy one here but how do I get a sequence to get used as mentioned. For example in the following I want to automatically create files that have a 2 digit number at the end of their names: m@pyhead:~$ for x in $(seq 00 10); do touch file_$x; done m@pyhead:~$ ls file*... (2 Replies)
Discussion started by: amadain
2 Replies

5. Shell Programming and Scripting

Verify the input

I run the script with one parameter : myscript abc002 But I need my script to check the parameter in txt array first: txt="abc001 abc002 abc004" What's the best way to do it? I am using ksh. #! /usr/bin/ksh txt="abc001 abc002 abc004" if ; then echo " Your input is wrong,... (9 Replies)
Discussion started by: newoz
9 Replies

6. AIX

verify command

Guy's I have script doing many steps as the below ... ############# ## step1# mount all Files system mount all ## step2# Start the application /app/appsh ############# but some time mount points will not be mounted completely so that will give an error if the next step started... (1 Reply)
Discussion started by: Mr.AIX
1 Replies

7. Shell Programming and Scripting

Find filenames with three digits and add zeros to make five digits

Hello all! I've looked all over the internet and this site and have come up a loss with an easy way to make a bash script to do what I want to do. I have a file with a naming convention as follows: 2012-01-18 string of words here 123.jpg 2012-01-18 string of words here 1234.jpg 2012-01-18... (2 Replies)
Discussion started by: Buzzman25
2 Replies

8. Hardware

Verify patching

I patched a linux kernel 2.6.28 with lttng patch. Now I have two folder of linux patched and unpatched. How can I verify whether the linux is patched or unptahced(original version)? (0 Replies)
Discussion started by: rupeshkp728
0 Replies

9. Red Hat

Verify multipathing

I have a couple of questions regarding multipath. If I do vgdisplay vg01, I see it is using 1 PV: /dev/dm-13 If I type multipath -ll I see dm-9, dm-10, dm-11, dm-12, but do not see dm-13. Is my vg01 multipathed? How can I actually know for sure? Secondly, let's say this time vg01 says... (1 Reply)
Discussion started by: keelba
1 Replies

10. UNIX for Beginners Questions & Answers

sed / awk script to delete the two digits from first 3 digits

Hi All , I am having an input file as stated below 5728 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r03_q_reg_20_/Q 011 611 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r04_q_reg_20_/Q 011 3486... (4 Replies)
Discussion started by: kshitij
4 Replies
PG_FIELD_IS_NULL(3)													       PG_FIELD_IS_NULL(3)

pg_field_is_null - Test if a field is SQL NULL

SYNOPSIS
int pg_field_is_null (resource $result, int $row, mixed $field) DESCRIPTION
int pg_field_is_null (resource $result, mixed $field) pg_field_is_null(3) tests if a field in a PostgreSQL result resource is SQL NULL or not. Note This function used to be called pg_fieldisnull(3). PARAMETERS
o $result - PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others). o $row - Row number in result to fetch. Rows are numbered from 0 upwards. If omitted, current row is fetched. o $field - Field number (starting from 0) as an integer or the field name as a string. RETURN VALUES
Returns 1 if the field in the given row is SQL NULL, 0 if not. FALSE is returned if the row is out of range, or upon any other error. EXAMPLES
Example #1 pg_field_is_null(3) example <?php $dbconn = pg_connect("dbname=publisher") or die ("Could not connect"); $res = pg_query($dbconn, "select * from authors where author = 'Orwell'"); if ($res) { if (pg_field_is_null($res, 0, "year") == 1) { echo "The value of the field year is null. "; } if (pg_field_is_null($res, 0, "year") == 0) { echo "The value of the field year is not null. "; } } ?> PHP Documentation Group PG_FIELD_IS_NULL(3)
All times are GMT -4. The time now is 12:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy