Sponsored Content
Top Forums Shell Programming and Scripting Why do these 2 methods result in different outcomes? Post 303021980 by BLinux on Wednesday 22nd of August 2018 03:41:34 AM
Old 08-22-2018
thank you everyone. i got it now. i was confused about the return behavior of (( counter++ )). so, to get what i was expecting, i can use either:

Code:
(( ++counter ))
(( counter = counter + 1 ))
counter=$((counter+1))
let counter=counter+1

all of the above would return 0. where as:

Code:
(( counter++ ))

would return 1 (when counter=0), but return 0 after counter > 0.




Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 08-22-2018 at 05:24 AM.. Reason: Added CODE tags.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

file transfer Methods

I would like to write shell script to transfer some ASCII files from HPUX server to Linux server or vice-versa. What options I have for file transfer Methods. 1) FTP 2) rcp 3) HTTP 4)Whatelse? (2 Replies)
Discussion started by: Teh Tiack Ein
2 Replies

2. What is on Your Mind?

Predict Future Outcomes in Our Event Prediction Market

Folks love to predict the future, so we have enabled predicting the future for members. So, please enjoy placing your Forum Bits predicting future outcomes in our new Event Prediction Market. Current events you can predict include science, technology, M&A and other global events: Oracle... (0 Replies)
Discussion started by: Neo
0 Replies

3. Shell Programming and Scripting

Methods to SSH (Perl)...

Can anyone break down the different methods of using SSH in perl? I'm currently using Net::SSH::Expect, which allows me to login to a machine and execute multiple commands without having to ssh again. This feature of holding the session works well for me, but it's slow. If I set timeouts to 4... (3 Replies)
Discussion started by: mrwatkin
3 Replies

4. UNIX for Advanced & Expert Users

yum provides methods

What is the difference between these yum provides and whatprovides methods? I know provides and whatprovides give the same results, but different methods of */ and \* give different results. Also whether you put */ and \* in front of the string or behind the string give different results. I have... (0 Replies)
Discussion started by: cokedude
0 Replies

5. Solaris

Unix learning methods

I have recently completed Solaris 10 System Administration book by Bill Calkins. Now I want to learn more about UNIX. I have tried to research online but there is too much information and I am sort of overwhelmed and don't know where to start. Can anybody give some idea on how to pursue my learning... (3 Replies)
Discussion started by: saudsos
3 Replies

6. Shell Programming and Scripting

Perl Methods Calling

Hello I am on my way to improve my wonderful Perl skills, I got an issue which I want to share with you all. I have a Perl module which looks like package Cocoa; require Exporter; @ISA = qw(Exporter); my $a=''; my $b=''; my $c=''; sub new { my $this = shift; # Create... (8 Replies)
Discussion started by: adisky123
8 Replies

7. Shell Programming and Scripting

How to compare the current result with previous line result.?

Hi Gurus, I have requirement to compare current result with previous reuslt. The sample case is below. 1 job1 1 1 job2 2 1 job3 3 2 job_a1 1 2 job_a2 2 2 job_a3 3 3 job_b1 1 3 job_b2 2 for above sample file, GID is group ID, for input line, the job run... (1 Reply)
Discussion started by: ken6503
1 Replies

8. Linux

Help with PAM Logging methods.

Hi Folks, Would like to understand if there exists any method to write the logs for LDAP authenticated users and Local Users separately in two different files. If not, then do I distinguish whether the user is LDAP or local without looking at passwd. Bye the way, I am trying this weird... (0 Replies)
Discussion started by: awk-admirer
0 Replies

9. UNIX for Beginners Questions & Answers

One Line Command how to use pipe statements to execute and comment on multiple possible outcomes

Hello Forum, I'm looking to expand the following command: INACTIVE_KERNELS=$(python -mplatform | grep -qi red && rpm -qa | grep '^kernel-' |grep -vE `uname -r` | paste -sd \; || echo "Not Red Hat Server") Currently this command will check if my server is RedHat server using the grep -qi... (6 Replies)
Discussion started by: greavette
6 Replies
roar_connectionref(3)					System Manager's Manual: RoarAudio				     roar_connectionref(3)

NAME
roar_connectionref, roar_connectionunref - change reference counter for RoarAudio connections SYNOPSIS
#include <roaraudio.h> int roar_connectionref(struct roar_connection * con); int roar_connectionunref(struct roar_connection * con); #define roar_disconnect(x) roar_connectionunref((x)) DESCRIPTION
Those functions change the reference counter for connection objects previously opend via roar_connect(3), roar_connect_fh(3) or roar_sim- ple_connect(3). If the reference counter hints zero the connection is closed and the object is destroyed. The roar_disconnect(3) macro is provided to be source compatible (recompile needed) with RoarAudio 0.4 or older. PARAMETERS
con The connection to be altered. RETURN VALUE
On success these calls return 0. On error, -1 is returned. EXAMPLES
FIXME SEE ALSO
roar_simple_connect(3), libroar(7), RoarAudio(7). RoarAudio May 2011 roar_connectionref(3)
All times are GMT -4. The time now is 01:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy