read number form function
Hello Everyone!
i have the following code:
#!/bin/bash
function get
{
read $1
if [ ! -n "$1" ]
then
$1=0
fi
}
get n
get m
echo n = $n
echo m = $m
now if we just press enter key at read instance. it should assign a zero value. But this code is not assigning an integer value to $1 but a string.
|