Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4545992
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:53:28+00:00 2026-05-21T15:53:28+00:00

while sizes=`sizes $pgid` do set — $sizes sample=$((${@/#/+})) let peak=sample > peak ? sample

  • 0
while sizes=`sizes $pgid`
do
    set -- $sizes
    sample=$((${@/#/+}))
    let peak="sample > peak ? sample : peak"
    sleep 0.1
done

i am confused about the below statement:

sample=$((${@/#/+}))

could anybody explain this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T15:53:28+00:00Added an answer on May 21, 2026 at 3:53 pm

    The ‘${@/#/+}‘ part is a regular expression expansion:

    ${parameter/pattern/string}
    

    The pattern is expanded to produce a pattern just as in filename expansion.
    Parameter is expanded and the longest match of pattern against its value is
    replaced with string. If pattern begins with ‘/‘, all matches of pattern are replaced
    with string. Normally only the first match is replaced. If pattern begins
    with ‘#‘, it must match at the beginning of the expanded value of parameter.
    If pattern begins with ‘%‘, it must match at the end of the expanded value of
    parameter. If string is null, matches of pattern are deleted and the / following
    pattern may be omitted. If parameter is ‘@‘ or ‘*‘, the substitution operation
    is applied to each positional parameter in turn, and the expansion is the resultant
    list. If parameter is an array variable subscripted with ‘@‘ or ‘*‘, the
    substitution operation is applied to each member of the array in turn, and the
    expansion is the resultant list.

    So, it looks like it replaces the empty string at the start of each value in the argument list ‘$@‘ with a ‘+‘. It’s key merit is that it prefixes each argument in one fell swoop; otherwise, it is similar to "+$var".


    The ‘$(( ... )) part is an arithmetic expression. It performs arithmetic on the expression between the parentheses. So, in context, it adds up the values in the argument list, assuming they are all numeric. Given the expansion, it might yield:

    set -- 2 3 5 7 11
    sample=$((${@/#/+}))
    sample1=$((+2 +3 +5 +7 +11))
    echo $sample = $sample1
    

    and hence ‘28 = 28‘.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a console application that successfully re-sizes an image while maintaining aspect ratio.
I'm still learning about Android, and while playing around with TabHost and TabWidget ,
What is the best way to position multiple divs with differing sizes on the
I've searching for this for a while now online (Google, and StackOverflow), but haven't
Given an amount in ml and 3 pack sizes (20ml, 200ml and 1000ml) I'd
I recently asked a question about the same function, that solved my probelem and
According to android icon design guidelines ( here , see table #1), developer needs
I'm new to iPhone dev and Obj-C and I have several problems with ScrollView/ImageView
I want to plot several curves, each having a different length. So, I've placed
I need to put some icons for font size up and font size down

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.