sh script: problem with return value in function
This script is supposed to return the difference in time between two files,
simulator.o and discretizer.o. Instead, the it prints out a bunch of blank lines. It is as though the function I have defined is not properly returning a value. Any help is greatly appreciated! Thanks, Jameson Code:
function get_time_diff() { |
The best way to "return" data from a shell script function is to have that function send the data to standard output, rather than using the bash return statement, because the return code which is sent back by the return statement is a relatively small integer which shows success or failure. Indeed, you show that you expect the result from your function to come via standard output when you say:
Code:
echo `get_time_diff $unit` Code:
return $raw_time Code:
echo $raw_time Code:
return `expr $raw_time / 60` Code:
expr $raw_time / 60 Hope this helps. |
All times are GMT -5. The time now is 09:41 AM. |