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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:38:05+00:00 2026-06-13T20:38:05+00:00

In an inline shell, I type echo $(max 15 2) but don’t get any

  • 0

In an inline shell, I type echo $(max 15 2) but don’t get any answer?

Why is it so?

Code:

function max {
  if [ "$1" -eq "$2" ]
  then
    return $1
  else
    if [ "$1" -gt "$2" ]
    then
      return $1
    else
      return $2
    fi
  fi
}
  • 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-06-13T20:38:07+00:00Added an answer on June 13, 2026 at 8:38 pm

    From the comments :

    • Replace return with echo and your code works fine. – Blender

    • The $(...) syntax is specifically designed to give you the output of a command, even if that command happens to be a function call. return in a function is similar to exit for the script as a whole; it sets its status, which is an integer in the range 0 to 255. (This is quite different from other languages you might be used to, where return is used to return a value from a function.) – Keith Thompson

    • Bash functions are not like functions in other languages. They behave the same as any other command: they can take command line arguments, read from standard input, write to standard output and standard error, and return with an exit status. They don’t–strictly speaking–return a computed value. – chepner

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

Sidebar

Related Questions

All the code is inline here: http://shanxinc.com/test/fancybox2/ All I'm trying to do is get
I am trying to convert my shell scripts into python code, but I am
$10.3/5 The return type of an overriding function shall be either identical to the
Non inline function defined in header file with guards #if !defined(HEADER_RANDOM_H) #define HEADER_RANDOM_H void
Minimal code: // --------inline.h-------- struct X { static inline void foo (); }; #ifdef
Assume this code: static inline void inc(int64_t* atomic) { __asm__ __volatile__ ( lock incq
Multiple inline scripts: <script type=text/javascript>/* some codeblock 1 */</script> <script type=text/javascript>/* some codeblock 2
Can inline function be declared in .h and defined once in .c?
public: inline int GetValue() const { return m_nValue; } inline void SetValue(int nNewValue) {
I would usually write SQL statements inline in a Bash shell script to be

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.