Sponsored Content
Top Forums Programming Code review: recursion in circular array, reduce two functions to one? Post 303014933 by f77hack on Friday 23rd of March 2018 04:38:52 PM
Old 03-23-2018
Quote:
Originally Posted by rbatte1

Does that help, or have I missed the point?
Robin
Hello Robin, that definitely helps. The original code is swift but I don't mind if code is bash, perl... I just need to see some code that works.
Thank you.

---------- Post updated at 03:34 PM ---------- Previous update was at 03:25 PM ----------

Quote:
Originally Posted by RudiC
For an index not to exceed array boundaries the modulo operator has proven quite helpful.
Thanks for the input. I gave that a try but couldn't quite work out how to flip the counter to count down negative. I'm not that informed on how to flip the pointer.

---------- Post updated at 03:38 PM ---------- Previous update was at 03:34 PM ----------

Quote:
Originally Posted by stomp
Remark
Don't use global variables like this in a bigger script!
Thank you.

Last edited by f77hack; 03-23-2018 at 05:34 PM.. Reason: typo
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can some review my code would be appreicated?

I am getting an error "ftpNotes.sh: syntax error at line 8 : `<<' unmatched" #!/bin/ksh PATH=/usr/sbin/:/usr/bin:/usr/ucb:/etc:/usr/local/bin:. cd $HOME if ;then if ; then echo 'DSC file already ftp to epm server' else ftp -n epmdev00 <<SCRIPT... (1 Reply)
Discussion started by: sibghat
1 Replies

2. Shell Programming and Scripting

Can someone review my code tell me where I am going wrong?

Started writing my code. my read input is not even asking nor working? And I get a EOF script error. echo "1) aragorn.domain.net" echo "2) marvel.domain.net" echo "3) athena.domain.net" echo "4) gandalf.domain.net" echo "5) griffin.domain.net" echo "What server would you like... (4 Replies)
Discussion started by: chrchcol
4 Replies

3. Shell Programming and Scripting

Tricky array substitution in functions

Hello, Please tell me if there is a better way to get the number of elements from an array that is passed to a function. This is what works on Solaris 8 (ksh) but it looks odd: loop_array() { array_name=$2 b1='\${\#' b2='}' nr_elements=`eval echo... (6 Replies)
Discussion started by: majormark
6 Replies

4. Programming

[ C ] multidemensional array pass to functions

Please excuse my ineptitude for a bit as I've been spoiled for the past few months with only writing perl code instead of C. So ok, I've been thinking about some code to change the crc32 values that are held within central directory headers of zip files. Because I'm lazy I decided to just... (3 Replies)
Discussion started by: VRoemer
3 Replies

5. Shell Programming and Scripting

How to reduce code.....

Hi All, Could some one help me to reduce the code... if then ./plist -m "$queuename" |grep $2|awk '{print $3}' >unlock.log elif then ./plist -m "$queuename" |grep $2|awk '{print $4}' >unlock.log else ./plist -m "$queuename" |grep $2|awk '{print $5}' >unlock.log . . . . ... (1 Reply)
Discussion started by: harshakusam
1 Replies

6. Shell Programming and Scripting

Passing array to functions in ksh script

Let me know if there is a way to pass array to a funtion in ksh script. function isPresent { typeset member member=$1 dbList=$2 echo '$1:' $1 echo '$2' $dbList The array will be at the second position....something like this isPresent 12 <array> if then echo... (3 Replies)
Discussion started by: prasperl
3 Replies

7. Programming

c++ code to check whether a list is circular or not

hi all, i need c++ code to check whether a list is circular or not... please help (8 Replies)
Discussion started by: vidyaj
8 Replies

8. Shell Programming and Scripting

Need help on Assigning a Array variable from Background Functions

I have a question on how can I assign a output of a function to a variable which is executed in background. Here is my example $ cat sample_program.sh #!/bin/ksh exec_func () { sleep 1 v=`expr $1 + 100` print $v } export OUT_ARR date for i in 1 2 do OUT_ARR=`exec_func $i` &... (1 Reply)
Discussion started by: mohan_kumarcs
1 Replies

9. Shell Programming and Scripting

Reduce the number of lines by using Array

I have the following code to count the number of how many times the name occurred in one file. The code is working fine and the output is exactly what I want. The problem is the real code has more than 50 names in function listname which cause function name to have more than 50 case ,and function... (14 Replies)
Discussion started by: samsan
14 Replies
GIT-REVIEW(1)						    BSD General Commands Manual 					     GIT-REVIEW(1)

NAME
git-review -- Submit changes to Gerrit for review SYNOPSIS
git-review [-r remote] [-uv] -d change [branch] git-review [-r remote] [-fnuv] -s [branch] git-review [-fnuvDR] [-r remote] [-t topic] [branch] git-review --version DESCRIPTION
git-review automates and streamlines some of the tasks involved with submitting local changes to a Gerrit server for review. It is designed to make it easier to apprehend Gerrit, especially for users that have recently switched to Git from another version control system. The following options are available: -d change, --download=change Download change from Gerrit into a local branch. The branch will be named after the patch author and the name of a topic. If the local branch already exists, it will attempt to update with the latest patchset for this change. -f, --finish Close down the local branch and switch back to the target branch on successful submission. -n, --dry-run Don't actually perform any commands that have direct effects. Print them instead. -r remote, --remote=remote Git remote to use for Gerrit. -s, --setup Just run the repo setup commands but don't submit anything. -t topic, --topic=topic Sets the target topic for this change on the gerrit server. If not specified, a bug number from the commit summary will be used. Alternatively, the local branch name will be used if different from remote branch. -u, --update Skip cached local copies and force updates from network resources. -l, --list List the available reviews on the gerrit server for this project. -y, --yes Indicate that you do, in fact, understand if you are submitting more than one patch. -v --verbose Turns on more verbose output. -D, --draft Submit review as a draft. Requires Gerrit 2.3 or newer. -R, --no-rebase Do not automatically perform a rebase before submitting the change to Gerrit. When submitting a change for review, you will usually want it to be based on the tip of upstream branch in order to avoid possible conflicts. When amending a change and rebasing the new patchset, the Gerrit web interface will show a difference between the two patchsets which contains all commits in between. This may confuse many reviewers that would expect to see a much simpler difference. --version Print the version number and exit. FILES
To use git-review with your project, it is recommended that you create a file at the root of the repository named .gitreview and place infor- mation about your gerrit installation in it. The format is similar to the Windows .ini file format: [gerrit] host=hostname port=TCP port number of gerrit project=project name defaultbranch=branch to work on It is also possible to specify optional default name for the Git remote using the defaultremote configuration parameter. Setting defaultrebase to zero will make git-review not to rebase changes by default (same as the -R command line option) [gerrit] host=review.example.com port=29418 project=department/project.git defaultbranch=master defaultremote=review defaultrebase=0 EXAMPLES
To fetch a remote change number 3004: $ git-review -d 3004 Downloading refs/changes/04/3004/1 from gerrit into review/someone/topic_name Switched to branch 'review/someone/topic_name $ git branch master * review/author/topic_name Gerrit looks up both name of the author and the topic name from Gerrit to name a local branch. This facilitates easier identification of changes. To send a change for review and delete local branch afterwards: $ git-review -f remote: Resolving deltas: 0% (0/8) To ssh://username@review.example.com/departement/project.git * [new branch] HEAD -> refs/for/master/topic_name Switched to branch 'master' Deleted branch 'review/someone/topic_name' $ git branch * master An example .gitreview configuration file for a project department/project hosted on review.example.com port 29418 in the branch master : [gerrit] host=review.example.com port=29418 project=department/project.git defaultbranch=master BUGS
Bug reports can be submitted to https://launchpad.net/git-review AUTHORS
git-review is maintained by OpenStack, LLC This manpage has been enhanced by: Antoine Musso <hashar@free.fr> Marcin Cieslak <saper@saper.info> April 4th, 2012
All times are GMT -4. The time now is 09:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy