can I use this coding

I apologise because I had pasted this question in the newbies forum first (because i am a bit of a newbie) but thought it might be better suited in here

if i have to sepearate parameters can I use this syntax especially the or part (||) and is this correct

if [ "${CURR_STATUS}" || "${CURR_STATUSTEST}" != "${NEW_STATUS}" ]

why not try it befor you ask if it works?

Optimus cheers for the offhand reply

the code was tried (but as I said Im fairly new and not to clued up on the syntax) so although this particular part of the code may not work it may be due to the syntax rather than than the coding

i.e.

this coding was correct

CURR_STATUS =`cat /export/home/troberts/status_LIVE`

but it took me nearly 8hrs to work out the syntax was wrong.
should have been

CURR_STATUS=`cat /export/home/troberts/status_LIVE`

so the question was not an error on my part, just a general enquiry that I thought may have been answered with a little more understanding

I'd use double brackets:

if [[ "${CURR_STATUS}" || "${CURR_STATUSTEST}" != "${NEW_STATUS}" ]]

Besides that, it should work, but I'm not sure what you intend it to do. Basically, the statement will be true if either:

1) CURR_STATUS is anything (other than null), or
2) CURR_STATUSTEST and NEW_STATUS do not match

Cheers OOmbera

The code is used as validation when changing a password in a case statement where there are 2 seperate enviroments to compare

ie case and casetest

Thanx again

Well I will point out that your question did not exhibit much thoughtfullness on your part. You did not tell us what shell you are using or what result you wanted. Futhermore it was a crosspost which is a violation of our rules. You reap what you sow. I choose to ignore your question other than deleting the duplicate post.

I still don't know what shell you're using, but the syntax that oombera suggests seems to be illegal in ksh. Some quick experiments with bash seem to suggest that it does work there, but on bash, [ and [[ just seem to be the same thing. (On the other hand, many shells will accept your original syntax.)

I usually try code before I post it. I did this time too. For me, it worked in ksh with double brackets, but not with single, so it seemed like a legit suggestion.

That's our Perderabo ... mr. congeniality. :stuck_out_tongue:

---------
oh well, what can you say about someone who knows 1000x as much unix as you do..? just deal with it i guess... :slight_smile: