Sponsored Content
Top Forums Shell Programming and Scripting Confirming Syntax - IF statement. Post 302178586 by Cameron on Wednesday 26th of March 2008 01:06:16 AM
Old 03-26-2008
Question Confirming Syntax - IF statement.

Hi All,

Has been a while since I was last on, so I hope everyone has been doing fine. Smilie

Would like to know if the below IF statement syntax is correct for a ksh environment. It's been pushed into live as someone had deleted the development copy(!); not withstanding that, the statement now won't be called/executed until May 5th. So if there is any obvious issues seen, I'll have time to fix.

Any/all feedback appreciated.

Cheers,
Cameron
Code:
if [ \( "${MKT}"="PU" -o "${MKT}"="PH" \) -a "${FILETYPE}"="PAY" ] ; then
  cp ${FTP_DIR}/${MKT}-${DOR}.BANKHOLIDAY \
     ${FTP_ARC}/${MKT}-${DOR}-${FILETYPE}.BANKHOLIDAY
else
  mv ${FTP_DIR}/${MKT}-${DOR}.BANKHOLIDAY \
     ${FTP_ARC}/${MKT}-${DOR}-${FILETYPE}.BANKHOLIDAY
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

syntax error on if statement

Hi, Can you please help me with this one: I write an "if" statement, something like this: if then echo "big file" else echo "normal file" and I get an error: `'then is not expected Thanks in advance (6 Replies)
Discussion started by: apenkov
6 Replies

2. UNIX for Dummies Questions & Answers

if statement code syntax

Hi, can someone please tell me what is wrong with this code? I just want it to check if the file size is greater than 2000kb. if Thanks! ---------- Post updated at 09:23 PM ---------- Previous update was at 09:21 PM ---------- I should probably post the full code: #!/bin/sh... (9 Replies)
Discussion started by: Bengel
9 Replies

3. Shell Programming and Scripting

Syntax error in script with if statement

I'm working on a function in a shell script I'm writing that will eventually take in and print out a list of vendor names and aliases (for my work) Here's the function in question: addvendorandalias () { echo echo -n 'Would you like to create a new vendor list (y or n)? ' read answer... (3 Replies)
Discussion started by: Straitsfan
3 Replies

4. AIX

Confirming command

Guy's I'm trying to create script to execute some critical commands in AIX like the below ... stopsrc -s qdaemon stopsrc -s sshd stopsrc -s lpd stopsrc -s nfsd I want between each command to ask me like this " are you sure to stop qdaemon " " are you sure to stop ssh" " are... (3 Replies)
Discussion started by: Mr.AIX
3 Replies

5. Shell Programming and Scripting

complex if statement syntax without using 'if ..' keyword in ksh.

It saves me lot of typing and space/lines when I do not use full 'if' keyword and construct, instead use .. && <statement> || <statement> that perfectly replaces.. if ; then <statement> else <statement> fi Can I use following syntax when I want to add multiple statements under 'if'... (4 Replies)
Discussion started by: kchinnam
4 Replies

6. Shell Programming and Scripting

Help with if statement syntax

Hi, Is there a way to compare the value in if condition with a list of values. eg . if ] then echo "it's a mammal" else echo "its not" fi Thanks! (8 Replies)
Discussion started by: neil.k
8 Replies

7. Shell Programming and Scripting

If statement Syntax error

Hi Can you please tell me what is wrong with this line: if && ]; then basically i want to check if x = 12 and F (Filename) end with 'g'. But it is throwing syntax error. (7 Replies)
Discussion started by: rtagarra
7 Replies

8. Shell Programming and Scripting

[Solved] 0403-057 Syntax error for if statement

I am getting the following error when I am running a script in ksh when trying to execute an if statement comparing two numerical values tstmb.sh: 1.5321e+08: 0403-057 Syntax error Below is my code snippet. #!/bin/ksh set -x TODAY=$(date +%y%m%d) for file in $(ls -rt *.log | tail... (11 Replies)
Discussion started by: kiran1112
11 Replies

9. Shell Programming and Scripting

Help with if statement syntax in shell script

I want to make the file test condition a variable ($Prmshn in code below). My goal is to use something like the first three unsuccessful if statetments since the 'if #!/bin/ksh test_input() { Prmshn=${1} InFLNm=${2} ifReq="-$Prmshn $InFLNm" #the following three if statments fail: #if ] ;... (10 Replies)
Discussion started by: ms63707
10 Replies

10. UNIX for Beginners Questions & Answers

Syntax for if statement

I'm new to unix and the command line and am trying to learn different commands. I have a file (teledir.txt) that contains a name and phone number for 3 different people. I am writing a script that is to take two positional parameters and I typed out how it should behave: if <name and number... (1 Reply)
Discussion started by: Eric7giants
1 Replies
CT-API(3)						     Library Functions Manual							 CT-API(3)

NAME
CT_init, CT_data, CT_close -- Functions to handle communication with integrated circuit cards and cardterminals SYNOPSIS
#include <ctapi.h> char CT_init( unsigned short ctn, unsigned short pn); char CT_data( unsigned short ctn, unsigned char * dad, unsigned char * sad, unsigned short lenc, unsigned char * command, unsigned short * lenr, unsigned char * response); char CT_close( unsigned short ctn); DESCRIPTION
This manual page describes the CT-API functions used to handle communication with integrated circuit cards and cardterminals. The CT-API functions are generic, and allows the use of memory cards (often referred as synchronous cards) and processor cards (often referred as asynchronous cards). The CT-API implementation is dependent on the cardterminal that is used. For each cardterminal a CT-API library implementation should be provided, either by the manufacturer or by third parties. This manpage is not a complete specification of the CT-API, but a general over- view of the most common functionalities. CT_init() selects and initializes the interface with the cardterminal (f.i. serial port, USB bus, or any other type of connector). The CT_init() function must be called before communicating with the card or the cardterminal. A unique cardterminal number chosen by the caller is assigned by the CT-API library to the initialized connection. ctn Cardterminal number: identifies the connection with the cardterminal for further references. It's chosen by the caller of the function. pn Port number: selects the physical interface. The port number assignment is dependent on the CT-API implementation. However most serial cardterminal implementations use the convention of assigning the value 0 to the first serial port, 1 to the second serial port and so on. See the file /usr/include/ctapi.h of your CT-API implementation for a list of allowed values. CT_data() sends a command to the card or to the cardterminal and returns the response to the calling program. ctn Cardterminal number: the number specified in CT_init() call for this cardterminal. dad Destination address. If the command is sent to the cardterminal, it must point to a variable containing the value CT (0x01). If the command is sent to a card, the destination address variable must be set to the number identifying the slot of the cardtermi- nal where the card is inserted, ranging from ICC1 (0x00) and ICC2 (0x02) to ICC14 (0x0E). On the return of the response, the variable pointed by dad is set to the value HOST (0x02) or REMOTE_HOST (0x05). sad Source address. When the function is called it is usually set to point to a variable with the value HOST (0x02), although the value REMOTE_HOST (0x05) may ocurr in some applications if the CT-API implementation supports remote calls. On the return of the response, the variable pointed by sad is set to any of the values from CT (0x01), ICC1 (0x00), ICC2 (0x02) to ICC14 (0x0E). lenc Command length in bytes. command Pointer to the buffer that conveys the command to be sent to the card or cardterminal. lenr Before function call, pointer to a variable containig the maximum buffer size in bytes for the response data. After successful function call it contains the size in bytes of the response data. response Pointer to the response data. Memory buffer of at least the size in bytes specified in lenr must be allocated before calling to the function. CT_close() terminates the communication with the cardterminal which has been assigned to a logical cardterminal number by the function CT_init(). The function shall be called for each initialized cardtreminal before the end of the program in order to free resources if nec- essary. ctn Cardterminal number: as specified in CT_init() call for this cardterminal. RETURN VALUE
CT_init(), CT_data(), and CT_close() functions return a value of type char. OK Function call was successful. ERR_INVALID Invalid parameter or value. ERR_CT Cardterminal Error. The cardterminal is temporarily not accessible (busy with other or internal processes). The problem can be solved by the application. ERR_TRANS Transmission Error. Transmission errors due to mechanical, electrical or protocol failures. Reset of the cardterminal is neces- sary. ERR_MEMORY Memory assignment error. A memory error occurred (f.i. the allocated buffer is too small for the returned data). ERR_HTSI Host Transport Service Interface error. Commonly returned if the error is produced by the software layer and not in the communi- cation with the hardware. SEE ALSO
ctbcs (3). The MKT (Multifunktionale KartenTerminals) specifications, available for download from Teletrust website http://www.teletrust.de (link to URL http://www.teletrust.de) . In special the documents: Part 3: CT-API. Cardterminal Applications Programming Interface. Part 4: CT-BCS. Cardterminal Basic Command Set. Part 7: IC cards with synchronous transmission Part3: Usage of interindustry Commands. ISO/IEC 7816: Identification cards - Integrated circuit(s) cards with contacts: Part 4: Interindustry commands for interchange. AUTHOR
This manual page was written by Carlos Prados <cprados@yahoo.com>. CT-API(3)
All times are GMT -4. The time now is 06:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy