Sponsored Content
Top Forums UNIX for Dummies Questions & Answers if statement not working as desired Post 302396884 by kminkeller on Friday 19th of February 2010 02:39:48 PM
Old 02-19-2010
if statement not working as desired

Hello all,

I am trying to write a post-commit hook script using bash script. What I am trying to do here is:

Developers check in their files to a branch. I check the repository and based on the commit I email QA people.

QA verifies and moves the files to a prod branch and email is sent out to managers.

below is an example of sending email to a QA user.
Code:
dev_found=`/usr/bin/svnlook changed $REPOS -r $REV | grep "dev"`

echo '##'$dev_found'##' >> $ACTION_LOG

if[ "$dev_found" <> '' ] then
        for i in `ls $EMAILS`; do
                $SENDMAIL -t < $i
        done
fi

but the problem here is this condition is good for all cases even when dev_found is empty and the conditional check does not work for that.

I have also tried the following conditional checks.
Code:
1. if[ "$dev_found" != '' ] then
2. if[ -n "$dev_found" ] then
3. if[ "$dev_found" != "" ] then
4. if[ "$dev_found" <> "" ] then

nothing seem to work. i get email when I move the files from dev branch to other branches like qa or prod. can any one help me with this? Thanks.

KM

Last edited by Scott; 02-19-2010 at 03:46 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find/if statement not working

Hi guys: I am trying to delete multiple files in a folder with different names. Below is the script that I was trying, but it doesn't work ************************** #!/bin/ksh DATE=`date '+20%y%m%d'` DEL_DIR=<dir where files have to be deleted> let DATE2=$(($DATE - 2)) let DATE1=$(($DATE... (12 Replies)
Discussion started by: geomonap
12 Replies

2. Shell Programming and Scripting

Script not working as desired

Reborg, Sorry to bother you. I have tried the code you suggested and it's not creating new files after they satisfy the criteria. If any of the files don't satisfy the criteria it should not create the files at all. Please see my output below. (39 Replies)
Discussion started by: mhssatya
39 Replies

3. Shell Programming and Scripting

If statement not working

I understand this question probably poses some child like stupidity, but I can't get this if statement to work for love or money. #!/bin/ksh echo "Input either 1 or 2" read Num if ; then echo "Message 1" if ; then echo "Message 2" else echo "false" fi $ ksh decisions Input either 1... (6 Replies)
Discussion started by: Hazmeister
6 Replies

4. UNIX for Dummies Questions & Answers

chmod not working as desired

my file had permission -rw-rw-r-- I did chmod +rwx, expecting everything to now be rwx, but it is -rwxrwxr-x why doesn't o have x permission? thanks. (2 Replies)
Discussion started by: JamesByars
2 Replies

5. Shell Programming and Scripting

C shell integer tests, less than and more than, not working as desired

Hello, I am creating a script that gives me system load info when i start a shell or log in via ssh(in the /etc/profile.d/ folder). I created it successfully for bash and want it to work with c-shell as well. This is where i'm having problems, the integer test in the if sentence does not work... (3 Replies)
Discussion started by: str1fe
3 Replies

6. UNIX for Dummies Questions & Answers

until statement not working

im trying to write an until statement which dont go onto the next stage until the user inputs a certain phrase. It is then stored in an array. Ive come up with this code so far but its not working and i dont know why. read in1 until do echo "Incorrect, try again" ... (2 Replies)
Discussion started by: strasner
2 Replies

7. Shell Programming and Scripting

If statement is not working.

Hi. With the help of this group I have created a shell script to find the factorial of a number. OK. Then I got wild.;) I tried to put in a check to make sure the entry is a number. read num If )) then echo "This is not a valid number. Try again." fi while (( $var <= $num)) more... (5 Replies)
Discussion started by: Ccccc
5 Replies

8. Shell Programming and Scripting

Cshell if statement not working

Hi .I am trying to check the first arguments =-s and the third =-d,but it doesnt work ,any idea why It gives me if: Missing file name Thanks #case -s and files if( $1 == "-s" && $3 != "-d" ) then echo "case s" endif (1 Reply)
Discussion started by: lio123
1 Replies

9. Shell Programming and Scripting

Cron job is not working in the desired manner on IBM AIX

Hi, I have created a cron job on IBM AIX but it is not working in desired manner ! Here are the steps which I have followed :- #!/bin/ksh #------------------------------------------------------------------ find /some/file/at/the/user/side/test.log -exec cp {}... (8 Replies)
Discussion started by: acidburn_007
8 Replies

10. Shell Programming and Scripting

Read statement not working

hello guys, i am having the below piece of code error () { echo"Press y /n" read ans case $ans in y) main;; n) exit esac } In the abve code, read statement is not working i.e not waiting for user to enter input. ,i tested exit status its 1. could anyone help me to do this ... (11 Replies)
Discussion started by: mohanalakshmi
11 Replies
GIT-ARCHIMPORT(1)						    Git Manual							 GIT-ARCHIMPORT(1)

NAME
git-archimport - Import an Arch repository into git SYNOPSIS
git archimport [-h] [-v] [-o] [-a] [-f] [-T] [-D depth] [-t tempdir] <archive/branch>[:<git-branch>] ... DESCRIPTION
Imports a project from one or more Arch repositories. It will follow branches and repositories within the namespaces defined by the <archive/branch> parameters supplied. If it cannot find the remote branch a merge comes from it will just import it as a regular commit. If it can find it, it will mark it as a merge whenever possible (see discussion below). The script expects you to provide the key roots where it can start the import from an initial import or tag type of Arch commit. It will follow and import new branches within the provided roots. It expects to be dealing with one project only. If it sees branches that have different roots, it will refuse to run. In that case, edit your <archive/branch> parameters to define clearly the scope of the import. git archimport uses tla extensively in the background to access the Arch repository. Make sure you have a recent version of tla available in the path. tla must know about the repositories you pass to git archimport. For the initial import, git archimport expects to find itself in an empty directory. To follow the development of a project that uses Arch, rerun git archimport with the same parameters as the initial import to perform incremental imports. While git archimport will try to create sensible branch names for the archives that it imports, it is also possible to specify git branch names manually. To do so, write a git branch name after each <archive/branch> parameter, separated by a colon. This way, you can shorten the Arch branch names and convert Arch jargon to git jargon, for example mapping a "PROJECT--devo--VERSION" branch to "master". Associating multiple Arch branches to one git branch is possible; the result will make the most sense only if no commits are made to the first branch, after the second branch is created. Still, this is useful to convert Arch repositories that had been rotated periodically. MERGES
Patch merge data from Arch is used to mark merges in git as well. git does not care much about tracking patches, and only considers a merge when a branch incorporates all the commits since the point they forked. The end result is that git will have a good idea of how far branches have diverged. So the import process does lose some patch-trading metadata. Fortunately, when you try and merge branches imported from Arch, git will find a good merge base, and it has a good chance of identifying patches that have been traded out-of-sequence between the branches. OPTIONS
-h Display usage. -v Verbose output. -T Many tags. Will create a tag for every commit, reflecting the commit name in the Arch repository. -f Use the fast patchset import strategy. This can be significantly faster for large trees, but cannot handle directory renames or permissions changes. The default strategy is slow and safe. -o Use this for compatibility with old-style branch names used by earlier versions of git archimport. Old-style branch names were category--branch, whereas new-style branch names are archive,category--branch--version. In both cases, names given on the command-line will override the automatically-generated ones. -D <depth> Follow merge ancestry and attempt to import trees that have been merged from. Specify a depth greater than 1 if patch logs have been pruned. -a Attempt to auto-register archives at http://mirrors.sourcecontrol.net This is particularly useful with the -D option. -t <tmpdir> Override the default tempdir. <archive/branch> Archive/branch identifier in a format that tla log understands. GIT
Part of the git(1) suite Git 1.7.10.4 11/24/2012 GIT-ARCHIMPORT(1)
All times are GMT -4. The time now is 04:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy