Take the 2-minute tour ×

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

1 Answer 1

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: http://perldoc.perl.org/perlvar.html#General-Variables

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


