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

  • SEARCH
  • Home
  • 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 6095467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:48:55+00:00 2026-05-23T12:48:55+00:00

You can skip positional parameters with shift but can you delete positional parameters by

  • 0

You can skip positional parameters with shift but can you delete positional parameters by passing the position?

x(){ CODE; echo "$@"; }; x 1 2 3 4 5 6 7 8
> 1 2 4 5 6 7 8

I would like to add CODE to x() to delete positional parameter 3. I don’t want to do echo "${@:1:2} ${@:4:8}". After running CODE, $@ should only contain “1 2 4 5 6 7 8”.

  • 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-23T12:48:56+00:00Added an answer on May 23, 2026 at 12:48 pm

    The best way, if you want to be able to pass on the parameters to another process, or handle space separated parameters, is to re-set the parameters:

    $ x(){ echo "Parameter count before: $#"; set -- "${@:1:2}" "${@:4:8}"; echo "$@"; echo "Parameter count after: $#"; }
    $ x 1 2 3 4 5 6 7 8
    Parameter count before: 8
    1 2 4 5 6 7 8
    Parameter count after: 7
    

    To test that it works with non-trivial parameters:

    $ x $'a\n1' $'b\b2' 'c 3' 'd 4' 'e 5' 'f 6' 'g 7' $'h\t8'
    Parameter count before: 8
    a
    1 2 d 4 e 5 f 6 g 7 h   8
    Parameter count after: 7
    

    (Yes, $'\b' is a backspace)

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

Sidebar

Related Questions

You can skip to the bottom line if you don't care about the background:
if ConvertAll throw an exception on one element, can i just skip this element
If my Ajax requests set a X-Requested-With header, can I just skip the CSRF
Can anyone tell me how I can display a status message like 12 seconds
code link: http://jsbin.com/ozoma3/edit codes (can copy/paste to a .html file, and run it) :
Flash's MovieClip timeline is created in such way that can skip frames to preserve
Aspiring programmer here! You can skip this part if you find it irrelevant. Im
When you visit an application profile on FB, you can add that application to
I have recently read about how cursors should be avoided. Well, I would like
-> Short Introduction, you can SKIP this part I'm glad to be able to

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.