0

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


 {

  ETH_PORT=eth0
  echo $ETH_PORT

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

   }


 test
Eytan
  • 611
  • 6
  • 13
  • 27
  • Please do not [cross-post](http://stackoverflow.com/questions/9000937/ksh-print-the-last-value-from-parameter-without-print-the-parameter). – Dennis Williamson Jan 26 '12 at 16:42

1 Answers1

0

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.

Lasse
  • 416
  • 3
  • 6