Sponsored Content
Top Forums Shell Programming and Scripting [Solved] If statement in bash Post 302882993 by kristinu on Friday 10th of January 2014 09:53:56 AM
Old 01-10-2014
[Solved] If statement in bash

I have the following code in bash, however "set red frmt" is not displayed.

Code:
  echo "iarg_rd = $iarg_rd"

  iarg_rd="2"
  if [ ! -z "$iarg_rd" ]; then
    echo "Hello World"
  fi

  if [ ! -z "$iarg_colr" ]; then
    frmt="${gap}${!frmt_titl_yl}"

  elif [ ! -z "$iarg_bk" ]; then
    frmt="${gap}${!frmt_titl_bk}"

  elif [ ! -z "$iarg_rd" ]; then
    echo "set red frmt"
    frmt="${gap}${!frmt_titl_rd}"

  elif [ ! -z "$iarg_gn" ]; then
    frmt="${gap}${!frmt_titl_gn}"

  elif [ ! -z "$iarg_yl" ]; then
    frmt="${gap}${!frmt_titl_yl}"

  elif [ ! -z "$iarg_bl" ]; then
    frmt="${gap}${!frmt_titl_bl}"

  elif [ ! -z "$iarg_mg" ]; then
    frmt="${gap}${!frmt_titl_mg}"

  elif [ ! -z "$iarg_cy" ]; then
    frmt="${gap}${!frmt_titl_cy}"

  elif [ ! -z "$iarg_wh" ]; then
    frmt="${gap}${!frmt_titl_wh}"

  else
    frmt="${gap}${!frmt_titl}"

  fi

  echo "frmt = $frmt"

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Conditional statement in bash

I want to combine 2 conditional statements by using -o in bash, but it won't work. if ; then echo "The number needs to be between 0 and $nr" fi Each time i execute the file it says: ./selectCitaat: line 10: syntax error near unexpected token `$1' (3 Replies)
Discussion started by: doc.arne
3 Replies

2. Shell Programming and Scripting

bash if statement help needed

Hi I need a script with an if statement that goes. I need it to search through all files within a directory with the extension .test if it finds the string '71502FSC1206' then do sed 's/71502FSC1206/\n&/g' > send.test If it finds the string '715MCH' or '715JAC' then I need it to move the... (1 Reply)
Discussion started by: firefox2k2
1 Replies

3. Shell Programming and Scripting

[SOLVED] Problem in wait statement

Iam having a script which is used to load users and dumpfile in any given schema.Iam trying to autolog the script and have added two fucntion in it. function init_stdout_redirect { OUT_LOG=$1 OUT_PIPE=$(mktemp -u) # Create the output pipe mkfifo $OUT_PIPE # Save stdout and... (15 Replies)
Discussion started by: Vikram_Tanwar12
15 Replies

4. UNIX for Dummies Questions & Answers

Bash - OR within an IF statement

Hey guys, Currently trying to write a wee script that runs only when logged in as one of two users. The rest of the script is working fine, but no matter what user I try to run it as, it always fails! This is the puzzling part:if ]; then echo "Run script as admin " exit 1 else... (6 Replies)
Discussion started by: jimbob01
6 Replies

5. Shell Programming and Scripting

[Solved] Strange Problem in case statement while shift

Hi, Here is my code as below: test.ksh: ======= #!/bin/ksh option="${1}" while do case $1 in -f) FILE="${2}" echo "File name is $FILE" ;; -d) DIR="${2}" echo "Dir name is $DIR" ;; -*) echo "`basename ${0}`:usage: | " (5 Replies)
Discussion started by: zaq1xsw2
5 Replies

6. 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

7. Shell Programming and Scripting

[Solved] FOR loop / IF statement returning error

The code at the bottom is a simplified example of what we have. If I use the following: && echo "echo failed" $? returns 1 When I use if ; then echo "echo failed" ; fi $? returns 0 Does anyone know what's wrong with this? Using AIX 6.1 and KSH for NUM in 1 2 3 do ... (5 Replies)
Discussion started by: jfxdavies
5 Replies

8. Shell Programming and Scripting

[Solved] While read line and if statement not working

I'm looking for some help in figuring why my little bit of code will not process any entries other then the first one in my list. while read line ;do hostname=${line//\"} a=`ssh user@$hostname uptime;echo $?` if ];then dt=`date` touch... (6 Replies)
Discussion started by: whegra
6 Replies

9. Shell Programming and Scripting

BASH - case statement

Hi Gurus, I have the below BASH code which does not works for upper case alphabets except Z (upper case Z). What may be the reason. Also escape sequences like \n, \t, \b, \033(1m \033(0m (For bold letter) are not working. case $var in ) echo "Lower case alphabet" ;; ... (7 Replies)
Discussion started by: GaneshAnanth
7 Replies

10. UNIX for Dummies Questions & Answers

Bash statement equivalent

Hi all, i need a equivalent for the statement i run in bash, so it would also run in other shells. Specially i need it for ksh to run on AIX. Here the statements: exec > >(tee -a $log) exec 2> >(tee -a $log >&2) Thanks. (5 Replies)
Discussion started by: Kosak
5 Replies
ALLVERSUSALL(1e)					     EMBOSS Manual for Debian						  ALLVERSUSALL(1e)

NAME
allversusall - Sequence similarity data from all-versus-all comparison. SYNOPSIS
allversusall -seqinpath dirlist [-matrix matrixf] [-gapopen float] [-gapextend float] -datoutdir outdir -logfile outfile allversusall -help DESCRIPTION
allversusall is a command line program from EMBOSS ("the European Molecular Biology Open Software Suite"). It is part of the "Utils:Database creation" command group(s). OPTIONS
Input section -seqinpath dirlist Default value: ./ -matrix matrixf This option specifies the residue substitution matrix that is used for sequence comparison. Default value: EBLOSUM62 Required section Additional section -gapopen float This option specifies the gap insertion penalty. The gap insertion penalty is the score taken away when a gap is created. The best value depends on the choice of comparison matrix. The default value assumes you are using the EBLOSUM62 matrix for protein sequences, and the EDNAFULL matrix for nucleotide sequences. Default value: 10 -gapextend float This option specifies the gap extension penalty. The gap extension, penalty is added to the standard gap penalty for each base or residue in the gap. This is how long gaps are penalized. Usually you will expect a few long gaps rather than many short gaps, so the gap extension penalty should be lower than the gap penalty. An exception is where one or both sequences are single reads with possible sequencing errors in which case you would expect many single base gaps. You can get this result by setting the gap open penalty to zero (or very low) and using the gap extension penalty to control gap scoring. Default value: 0.5 Output section -datoutdir outdir This option specifies the location of sequence similarity data files (output). Default value: ./ -logfile outfile This option specifies the name of ALLVERSUSALL log file (output). The log file contains messages about any errors arising while ALLVERSUSALL ran. Default value: allversusall.log BUGS
Bugs can be reported to the Debian Bug Tracking system (http://bugs.debian.org/emboss), or directly to the EMBOSS developers (http://sourceforge.net/tracker/?group_id=93650&atid=605031). SEE ALSO
allversusall is fully documented via the tfm(1) system. AUTHOR
Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.org> Wrote the script used to autogenerate this manual page. COPYRIGHT
This manual page was autogenerated from an Ajax Control Definition of the EMBOSS package. It can be redistributed under the same terms as EMBOSS itself. DOMALIGN 0.1.0+20100721 08/11/2010 ALLVERSUSALL(1e)
All times are GMT -4. The time now is 07:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy