Sponsored Content
Top Forums Shell Programming and Scripting if statement with two conditions -e, && Post 74905 by yongho on Tuesday 14th of June 2005 09:59:00 AM
Old 06-14-2005
if statement with two conditions -e, &&

Wow I'm so zoned out I don't even know if I posted this question up already (I couldn't find it in my book marks or in "yesterday's" post).

My question is, I'm writing a korn script that does something like the following, but I don't yet completely understand the syntax. I need to check that the first field equals a string and that the second string equals a space. This isn't working -- is it right or wrong?

PHP Code:
FIELD1=`cut -c2-5 $FILENAME`
FIELD5=`cut -c68 $FILENAME`
 if [ 
$FIELD1 -eq 'ABC' && $FIELD5 -eq ' ' ]; then
$count
++
 
fi 
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using && in if statement ..

Hi All, Can some one tell me how to get run the following: data1="hello" data2="world" if then { echo "good afternnon" } else { echo " good morning" } fi The above code gives me an error ad below : ./if.h: line 3: ' (7 Replies)
Discussion started by: jisha
7 Replies

2. Shell Programming and Scripting

multiple conditions in if using && operator

VARIABLE="project" if && ] then echo "VARIABLE is not empty" fi this is not working what is wrong in the syntax?? (2 Replies)
Discussion started by: codeman007
2 Replies

3. Shell Programming and Scripting

PHP read large string & split in multidimensional arrays & assign fieldnames & write into MYSQL

Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP. I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies

4. Programming

IF && statement problem

Hello there, My first time on the forums, glad to be here :) I'm completely new to programming in PHP and I have a question which I hope someone could help me with. I am currently using this statement: if(($session == 2) && ($item == Dagger) && ($item2 == Dagger)){ ... (5 Replies)
Discussion started by: Hero
5 Replies

5. Shell Programming and Scripting

How to write If statement using && and operator in Unix

Hi What is the syntax for if statement using && and || operator? if && ] || here its giving me an error to this if statement any suggestion?? (2 Replies)
Discussion started by: Avi
2 Replies

6. Shell Programming and Scripting

if statement with '&&' gives error

Hi, I'm using the && operator in if statement: if ; then exp $UID/$PWD@$ORACLE_SID FILE=./DUMP/$TODAY$CONCAT_STR$USERNAME.dmp STATISTICS=NONE LOG=./LOG/$TODAY$CONCAT_STR$USERNAME.log elif ; then expdp $UID/$PWD@$ORACLE_SID DIRECTORY=./DUMP/ DUMPFILE=$TODAY$CONCAT_STR$USERNAME.dmp... (8 Replies)
Discussion started by: priya001
8 Replies

7. Shell Programming and Scripting

Using && in if statement with 3 expressions

how do you write an if statement for something like if ((expr 1 >= expr 2 && expr 3 >= expr 4) && expr 5 <= expr 6) if ((TRUE && TRUE) && TRUE) then condition... i've done it this way but it doesn't seem to work. if (] && "$ex_day" -le "$curr_day" ); then condition... (3 Replies)
Discussion started by: angilulu
3 Replies

8. Shell Programming and Scripting

GNU & BSD Makefile Directives & Conditions Compatibility

Firstly, I would like to apologize if this is not the appropriate sub-forum to post about GNU/BSD makefile scripting. Though my code is in C++, because I am focusing on the makefile I thought it would go better in shell scripting. Please correct me if I am wrong. Secondly, I am not interested in... (0 Replies)
Discussion started by: AntumDeluge
0 Replies

9. Shell Programming and Scripting

SFTP Shell Script Get & Delete && Upload & Delete

Hi All, Do you have any sample script, - auto get file from SFTP remote server and delete file in remove server after downloaded. - only download specify filename - auto upload file from local to SFTP remote server and delete local folder file after uploaded - only upload specify filename ... (3 Replies)
Discussion started by: weesiong
3 Replies

10. Shell Programming and Scripting

Bash: How to use read with conditions & loops

Hello, Below I try to control that the input is good an IP : #!/bin/bash cp /home/scripts/choice_interfaces.txt /home/scripts/interfaces.txt chmod 644 /home/scripts/interfaces.txt echo -e "Please enter the network informations into the /etc/network/interfaces file, complete them below... (9 Replies)
Discussion started by: Arnaudh78
9 Replies
dbus-uuidgen(1) 					      General Commands Manual						   dbus-uuidgen(1)

NAME
dbus-uuidgen - Utility to generate UUIDs SYNOPSIS
dbus-uuidgen [--version] [--ensure[=FILENAME]] [--get[=FILENAME]] DESCRIPTION
The dbus-uuidgen command generates or reads a universally unique ID. Note that the D-Bus UUID has no relationship to RFC 4122 and does not generate UUIDs compatible with that spec. Many systems have a sepa- rate command for that (often called "uuidgen"). See http://www.freedesktop.org/software/dbus/ for more information about D-Bus. The primary usage of dbus-uuidgen is to run in the post-install script of a D-Bus package like this: dbus-uuidgen --ensure This will ensure that /var/lib/dbus/machine-id exists and has the uuid in it. It won't overwrite an existing uuid, since this id should remain fixed for a single machine until the next reboot at least. The important properties of the machine UUID are that 1) it remains unchanged until the next reboot and 2) it is different for any two run- ning instances of the OS kernel. That is, if two processes see the same UUID, they should also see the same shared memory, UNIX domain sockets, local X displays, localhost.localdomain resolution, process IDs, and so forth. If you run dbus-uuidgen with no options it just prints a new uuid made up out of thin air. If you run it with --get, it prints the machine UUID by default, or the UUID in the specified file if you specify a file. If you try to change an existing machine-id on a running system, it will probably result in bad things happening. Don't try to change this file. Also, don't make it the same on two different systems; it needs to be different anytime there are two different kernels running. The UUID should be different on two different virtual machines, because there are two different kernels. OPTIONS
The following options are supported: --get[=FILENAME] If a filename is not given, defaults to localstatedir/lib/dbus/machine-id (localstatedir is usually /var). If this file exists and is valid, the uuid in the file is printed on stdout. Otherwise, the command exits with a nonzero status. --ensure[=FILENAME] If a filename is not given, defaults to localstatedir/lib/dbus/machine-id (localstatedir is usually /var). If this file exists then it will be validated, and a failure code returned if it contains the wrong thing. If the file does not exist, it will be created with a new uuid in it. On success, prints no output. --version Print the version of dbus-uuidgen AUTHOR
See http://www.freedesktop.org/software/dbus/doc/AUTHORS BUGS
Please send bug reports to the D-Bus mailing list or bug tracker, see http://www.freedesktop.org/software/dbus/ dbus-uuidgen(1)
All times are GMT -4. The time now is 07:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy