Sponsored Content
Top Forums Shell Programming and Scripting IF condition against a ARRAY in shell script Post 302416473 by Franklin52 on Monday 26th of April 2010 02:35:39 PM
Old 04-26-2010
Try something like this:
Code:
#!/bin/ksh
.
.
.

read ans

i=0
len=${#value[*]}

while [ $len -gt $i ]
do
  if [ "${value[$i]}" = "$ans" ]
  then
    # Do your stuff here
  fi
  i=$(( $i + 1 ))
done

I recommend you to read one of the tutorials here:

https://www.unix.com/answers-frequent...tutorials.html
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help with test condition in shell script

I'm new to scripting and I need help with a bourn shell script. What i'm trying to do is a test condition where "if the time is within 2 hours, it's true" and so on. The time is in the following format DATE=`/bin/date +"%Y%m%d%H%S"` for example, 20060907152000. So, what the script first... (9 Replies)
Discussion started by: pieman8080
9 Replies

2. Shell Programming and Scripting

Help with shell script to check the condition.

:) Hi, I want to script for this scenerio, OSR Settings Scenario : We are looking to find all the *.a files from the following locations in the filesystem of a server. OSR Directories /etc /bin /usr/bin /usr/sbin /var/adm These *.a files should have the permissions on... (12 Replies)
Discussion started by: sakthilinux
12 Replies

3. AIX

if condition in AIX5.3-10 shell script

True if file exists and has been modified since it was last read. if then command else exit fi i am on AIX5.3-10. it does not understand -N any other way. i can use -ot (file1 is older than file2), but prefer -N if possible. (3 Replies)
Discussion started by: tjmannonline
3 Replies

4. Shell Programming and Scripting

An issue with condition statement in shell script

Hello forum members. please go through the below mentioned issue and let me know the right solution. I have to write a script which runs another script .the executable script take input parmeters.so iam writing the the script below . Sample Code:Begins #! /bin/ksh echo " enter... (2 Replies)
Discussion started by: rajkumar_g
2 Replies

5. Shell Programming and Scripting

Errors in if condition validations-Shell Script

Hello All, i am facing difficulty in validating the values, kindly help me in resolving the issue. Thanks a lot in advance. -Chandra Script:Test.sh #! /bin/sh # *************************************************************************** # Function to display help function usage()... (1 Reply)
Discussion started by: duddukuri
1 Replies

6. UNIX for Dummies Questions & Answers

While condition in shell script

while do if ;then read driverName else driverName="" fi done can anyone please explain what exactly is happening on 1st line...is it like the conditions being ORed...I have no clue about this. (4 Replies)
Discussion started by: rtagarra
4 Replies

7. Shell Programming and Scripting

Substring check in IF condition in shell script

I want to check if the string has the substring in IF condition then process... i tried below but not working if ]; then ............. field can be "reserved1" ....reservedn / fillspaces1 ... fillspacesn (4 Replies)
Discussion started by: greenworld123
4 Replies

8. Shell Programming and Scripting

Need Help to add Condition in Shell Script..

Hi Team, I m very new to shell scripting , i want to add following condition in my script . Can anybody help me. There are three port in My node "$port" port_A port_B port_C I Want to add following Conditions in my script. If Node is connected to port_A and port_B script... (10 Replies)
Discussion started by: Ganesh Mankar
10 Replies

9. Shell Programming and Scripting

If condition shell script beginner

Hi all I have the folloing process that needs checking often: ps -ef | grep ih bscsrtx 206 15901 0 11:28:10 pts/6 0:00 fih -r4 bscsrtx 218 15901 0 11:28:27 pts/6 0:01 aih bscsrtx 29763 15901 4 11:27:16 pts/6 0:59 rdh -prih root 429 27268 0 11:30:15 pts/td ... (13 Replies)
Discussion started by: fretagi
13 Replies

10. Shell Programming and Scripting

Pass C shell array to another C shell script(csh) and shell(sh)

Dear Friends, Please help me on this my script name is send.csh In this i have written the statement like this set args = ( city state country price ) I want to pass this array to another c shell called receiver.csh. and i want to use it in this c shell or how to pass to... (2 Replies)
Discussion started by: SA_Palani
2 Replies
k3d(1)							      General Commands Manual							    k3d(1)

NAME
k3d - 3D modeling and animation system SYNOPSIS
k3d [options] DESCRIPTION
K-3D is a free (as in freedom) 3D modeling, animation, and rendering system for GNU/Linux and Win32. K-3D features a robust, object-ori- ented plugin architecture and is capable of producing motion-picture-quality output when paired with a RenderMan Interface compliant render engine such as Aqsis. Please visit http://www.k-3d.org for more information. OPTIONS
--add-path [path] Prepends a filesystem path to the PATH environment variable. --color Color-codes log messages based on their priority. Requires an ANSI color-capable terminal. --disable-gl-extension [extension] Disables the given OpenGL extension. --exit Exits the program (useful after running scripts in batch mode). -h, --help Prints this help information and exits. --log-level [level] Specifies the minimum message priority to log (valid values are "warning", "information", or "debug"). --options [path] Overrides the filepath for storing user options (this overrides both defaults and the K3D_OPTIONS_PATH environment variable, below). --plugins [path] Overrides the path(s) for loading plugin libraries (this overrides both defaults and the K3D_PLUGIN_PATHS environment variable, below). Multiple colon-delimited paths are allowed. Use "&" as a synonym for the default paths. --script [file] Play the given script after startup (use - for stdin). --shadercache [path] Overrides the path where compiled shaders will be cached (this overrides both defaults and the K3D_SHADER_CACHE_PATH environment variable, below). --share [path] Overrides the path for loading shared data files (this overrides both defaults and the K3D_SHARE_PATH environment variable, below). --show-process Prints the process name next to log messages. --show-timestamps Prints timestamps next to log messages. --syslog Logs messages to syslog. -u, --ui [ui path] Specifies the path to a user interface plugin (this overrides both the default and the K3D_USER_INTERFACE_PATH environment variable, below). As a special-case the string "none" can be used as a synonym for the Null (no gui) User Interface. -H, --user-interface-help Prints a user-interface specific help message and exits. --version Prints program version information and exits. USER INTERFACE OPTIONS
--batch Operate in batch (no user intervention) mode. -n, --new Creates a new document after startup. --no-custom-layouts Disable custom user interface layouts (useful when playing-back recorded tutorials, which rely on the default layout). --no-splash Disables the startup splash screen. -o, --open [file] Opens the given file after startup. --show-tutorials Opens the tutorials menu immediately following startup. --tutorials [path] Overrides the path for loading interactive tutorials (this overrides both defaults and the K3D_TUTORIALS_PATH environment variable, below). ENVIRONMENT VARIABLES
K3D_EXTRA_OPTIONS Provides additional options that are appended to the command-line at startup. Note that unlike other K-3D environment variables, options specified via K3D_EXTRA_OPTIONS will override options specified on the command line. K3D_OPTIONS_PATH Overrides the path for storing user options (this overrides the default, but can be overridden by the --options option, above). K3D_PLUGIN_PATHS Overrides the path(s) for loading plugin libraries (this overrides the default, but can be overridden by the --plugins option, above). Multiple colon-delimited paths are allowed. Use "&" as a synonym for the default paths. K3D_SHADER_CACHE_PATH Overrides the path where compiled shaders are cached (this overrides the default, but can be overridden by the --shadercache option, above). K3D_SHARE_PATH Overrides the path for loading shared data files (this overrides the default, but can be overridden by the --share option, above). K3D_USER_INTERFACE_PATH Overrides the path to the user interface plugin (this overrides the default, but can be overridden by the --ui option, above). AUTHORS
Written by Timothy M. Shead <tshead@k-3d.com>, and many others. REPORTING BUGS
Report bugs to <k3d-development@lists.sourceforge.net> COPYRIGHT
Copyright (c) 1995-2010, Timothy M. Shead. All Rights Reserved. This software is licensed under the terms of the GNU General Public License; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
The K-3D Home Page: http://www.k-3d.org K-3D Version 0.8.0.2 June 2010 k3d(1)
All times are GMT -4. The time now is 01:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy