What is the difference between filename=${1:-/etc/hosts} and filename=/etc/hosts?
For example:
filename=/etc/hosts
if [ -r "$filename" ] && [ -s "$filename" ]; then
md5sum $filename
else
echo "$filename cannot be processed"
fi
and
filename=${1:-/etc/hosts}
if [ -r "$filename" ] && [ -s "$filename" ]; then
md5sum $filename
else
echo "$filename cannot be processed"
fi
$1to null,/etc/hostsis assigned tofilename. – cuonglm Jun 29 '14 at 12:05./yourscript "" 2 3,filenameis set to/etc/hostseven if you had pass$1to script. – cuonglm Jun 29 '14 at 12:23