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 7435075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:59:59+00:00 2026-05-29T09:59:59+00:00

At a prompt, I can type: $ e() { echo $1; } and get

  • 0

At a prompt, I can type:

$ e() { echo $1; }

and get a function which echoes its first argument. I do not understand why this works. Since $1 is undefined in the current environment, it seems that the above should be equivalent to:

$ e() { echo ; }

What is the relevant quoting/interpolation rule that allows this behavior? Note that this has nothing to do with $1 being special: if you use $FOO, you get a function that echoes the value of $FOO at the time the function is called rather than the value of $FOO when the function is defined.

  • 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-29T10:00:00+00:00Added an answer on May 29, 2026 at 10:00 am

    Not sure how I missed this, since it’s pretty clear in section 2.9.5:

    When the function is declared, none of the expansions in wordexp shall be performed on the text in compound-command or io-redirect; all expansions shall be performed as normal each time the function is called. Similarly, the optional io-redirect redirections and any variable assignments within compound-command shall be performed during the execution of the function itself, not the function definition. See Consequences of Shell Errors for the consequences of failures of these operations on interactive and non-interactive shells.

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

Sidebar

Related Questions

Nomally, you will get a prompt like this: => where you can type in
In the Windows command prompt, I can type notepad helloworld.cpp which will then create
I have a c program which I can launch at command prompt. Is it
When I type... Msbuild<Enter> ...at the command prompt, I get... Microsoft (R) Build Engine
The Alt+f2 in ubuntu shows up Run Application prompt. I can type any command
When I type ipconfig /all in the windows command prompt, I get a bunch
From Python docs: sys.excepthook(type, value, traceback) This function prints out a given traceback and
I added a console in my game, in which I can type commands, and
In Flash, I can prompt the user for a location to save a file
I can change the irb prompt mode with irb --prompt prompt-mode I can see

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.