Sponsored Content
Full Discussion: elseif in csh
Top Forums Shell Programming and Scripting elseif in csh Post 302434302 by kristinu on Friday 2nd of July 2010 05:30:15 AM
Old 07-02-2010
"elseif" or "else if" in csh

I have been using the if statement in csh like this

Code:
if ( $opt1 == 1 ) then
 .....

elseif ( $opt2 == 1 ) then

......
endif


Seems to work, but got

Badly placed ()'s.


When I used a space in the elseif, a space between the 'else' and the 'if' it worked

Code:
if ( $opt1 == 1 ) then
 .....

else if ( $opt2 == 1 ) then

......
endif

Any idea why the thing sometimes works and sometimes not???

Last edited by kristinu; 07-02-2010 at 11:26 AM.. Reason: Clarification
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies

2. UNIX for Dummies Questions & Answers

csh

what is a .csh extension? there is a command line: mkaphed_ctio.csh Does anyone know what this is? :confused::confused::confused: (1 Reply)
Discussion started by: cosmologist
1 Replies

3. Shell Programming and Scripting

Awk if elseif syntax error

Below is the code. nawk -F "|" 'FNR==NR{a=$3 OFS $4 OFS $5 OFS $6;next} {\ if ($5 in a)\ {print $1,"ABC",$5,"I",a, $2,$3,$4 OFS OFS OFS OFS OFS OFS OFS OFS $2"-"$3"-"$4} ; \ elseif ($5=="g")\ print $1,"ABC",$5,"I",$5 OFS OFS OFS OFS $2,$3,$4 OFS OFS OFS OFS OFS... (8 Replies)
Discussion started by: pinnacle
8 Replies

4. Shell Programming and Scripting

if in csh

I am using this code echo "opt_tpath = $opt_tpath" if ($opt_tpath == 1) echo " -tpath = $Atpath\n" and is giving opt_tpath = 0 Atpath: Undefined variable. Atpath should only be printed in opt_tpath == 1 but it still tries to print. ---------- Post updated at 10:05 AM ----------... (1 Reply)
Discussion started by: kristinu
1 Replies

5. Linux

if elseif fi

Hi all, This is my first post in this forum, can i request you to guide, where i am going wrong with the error below. 34: Syntax error: "fi" unexpected (expecting "then") #!/bin/sh argCount=0 mysql_path=$USER_INSTALL_DIR$ for i in $*; do /A argCount+=1 done if ;then echo... (2 Replies)
Discussion started by: oracle_coorgi
2 Replies

6. Shell Programming and Scripting

if elseif fi

Hi, Ihave shifted this thread which i posted in linux forum to here if i am fault please correct me. When i excute this below script i am getting the follwing error can any one please look into it for persual. ./sample_oracle_tradescope.sh: 25: showDEFAULTUsage: not found ... (6 Replies)
Discussion started by: oracle_coorgi
6 Replies

7. UNIX for Dummies Questions & Answers

If Then ElseIf Script - Confusion Around Expression's Syntax

Hello, I am relatively new to UNIX scripting and am learning a lot. I have already tried several searches on this website and have tried various syntax options suggested to no avail. I am obviously not writing the script correctly. I really do appreciate any and all the help. Below is an... (8 Replies)
Discussion started by: dqrgk0
8 Replies

8. Shell Programming and Scripting

What does this do in CSH?

CSH experts What does the following do in CSH? :(){:|:&};: I was asked the question, but I don't know. I'm not aware of the context. Any ideas? Thanks! (1 Reply)
Discussion started by: wallg
1 Replies

9. Programming

Problem with IF ELSEIF and GOTO statements in FORTRAN

Hi I am reading a book about Fortran 90 and I write the following code, to test my understanding of the first chapter. I have a problem with the last section of the code with deals with an IF, ELSEIF, and GOTO statements. Here is my Code PROGRAM sim ! This code is used to solve two... (3 Replies)
Discussion started by: faizlo
3 Replies

10. AIX

Elseif & for condition in AIX

I'm using the below statements in my script if && then sqlplus sysadm/abcdefgh12@${dbarr} @/u1/scripts/ResetPswd.sql elif then for idx in 0 1 2 3 4 5 6 7 do sqlplus sysadm/abcdefgh12@${dbarr} @/u1/scripts/ResetPswd.sql done else exit fi It give me... (5 Replies)
Discussion started by: Pandee
5 Replies
IRSEND(1)							   User Commands							 IRSEND(1)

NAME
irsend - basic LIRC program to send infra-red commands SYNOPSIS
irsend [options] DIRECTIVE REMOTE CODE [CODE...] DESCRIPTION
Asks the lircd daemon to send one or more CIR (Consumer Infra-Red) commands. This is intended for remote control of electronic devices such as TV boxes, HiFi sets, etc. DIRECTIVE can be: SEND_ONCE - send CODE [CODE ...] once SEND_START - start repeating CODE SEND_STOP - stop repeating CODE LIST - list configured remote items SET_TRANSMITTERS - set transmitters NUM [NUM ...] SIMULATE - simulate IR event REMOTE is the name of a remote, as described in the lircd configuration file. CODE is the name of a remote control key of REMOTE, as it appears in the lircd configuration file. NUM is the transmitter number of the hardware device. For the LIST DIRECTIVE, REMOTE and/or CODE can be empty: LIST "" "" - list all configured remote names LIST REMOTE "" - list all codes of REMOTE LIST REMOTE CODE - list only CODE of REMOTE The SIMULATE command only works if it has been explicitly enabled in lircd. -h --help display usage summary -v --version display version -d --device use given lircd socket [/var/run/lirc/lircd] -a --address=host[:port] connect to lircd at this address -# --count=n send command n times EXAMPLES
irsend LIST DenonTuner "" irsend SEND_ONCE DenonTuner PROG-SCAN irsend SEND_ONCE OnkyoAmpli VOL-UP VOL-UP VOL-UP VOL-UP irsend SEND_START OnkyoAmpli VOL-DOWN ; sleep 3 irsend SEND_STOP OnkyoAmpli VOL-DOWN irsend SET_TRANSMITTERS 1 irsend SET_TRANSMITTERS 1 3 4 irsend SIMULATE "0000000000000476 00 OK TECHNISAT_ST3004S" FILES
/etc/lirc/lircd.conf Default lircd configuration file. It should contain all the remotes, their infra-red codes and the corresponding timing and wave- form details. DIAGNOSTICS
If lircd is not running (or /var/run/lirc/lircd lacks write permissions) irsend aborts with the following diagnostics: "irsend: could not connect to socket" "irsend: Connection refused" (or "Permission denied"). SEE ALSO
The documentation for lirc is maintained as html pages. They are located under html/ in the documentation directory. lircd(8), mode2(1), smode2(1), xmode2(1), irrecord(1), irw(1), http://www.lirc.org. irsend 0.9.0-pre1 October 2010 IRSEND(1)
All times are GMT -4. The time now is 07:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy