I find tilde expansion does not work for the following situation:
$ set -x
$ ./print_arg.pl destdir=~/test
+ ./print_arg.pl 'destdir=/root/test'
destdir=/root/test
$ ./print_arg.pl dest-dir=~/test
+ ./print_arg.pl 'dest-dir=~/test'
dest-dir=~/test
$ ./print_arg.pl -destdir=~/test
+ ./print_arg.pl '-destdir=~/test'
dest-dir=~/test
The contents of print_arg.pl is
#!/usr/bin/perl
print $ARGV[0],"\n";
According to Order of Shell processing, Shell will split word before "tilde expansion". And I noticed that word split are different actually. What is the reason for the different results?