2

Strange asterisk expansion

#!/bin/bash
my_IP=$(curl -m 5   -s  icanhazip.com)
rv=$?
szOut="--- curl error ($rv) ---"
if [ $rv -eq 0 ]; then
    szOut="*** today my IP is {$my_IP} ***"
fi
echo $szOut
exit 0

Under rv=0 I expected "* today my IP is {80.29.32.166} *

but got

get_ip.sh llegir_ip_externa.sh my_crons send_ftp.sh welcome.sag today my IP is {80.29.32.166} get_ip.sh llegir_ip_externa.sh my_crons send_ftp.sh welcome.sag

This is, the 3 asterisks expand into the list of files in this directory - 2 times, one at begin of line, other at end.

I fixed my problem changing "***" into "+++", but now I want to know the origin of this "expansion", as I use asterisks quite often.

Any pointer, URL, or PDF is welcome.

Thanks.

Cyrus
  • 84,225
  • 14
  • 89
  • 153
Sebastia.Net
  • 129
  • 2
  • 14

0 Answers0