Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need advice - how to print the same last value in ksh scripts without to print param argument

for example in perl last value is $_ , but we not have this option in ksh script

example - of ksh script

 function test


  echo $ETH_PORT

  echo < what need to write in order to print last value >


share|improve this question
Please do not cross-post. – Dennis Williamson Jan 26 '12 at 16:42
up vote 0 down vote accepted

It's not clear what behavior you want in your example. What exactly do you want the second echo to output?

I think you're confused about what $_ means in Perl. It does not refer to "the last value" but is a variable used implicitly in some cases. Refer to this page for clarification about what $_ is:

There is no "default variable" in the same meaning in ksh. A bare echo with no arguments will always just print a single linefeed. However if you want to tweak echo's behavior, you could overload it with a function.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.