为什么此脚本的输出中没有出现波浪符号扩展?
#!/bin/bash
read -p "Enter filename: " fname
if [[ -d $fname ]]
then
echo "$fname is a directory"
else
echo "$fname is not a directory"
fi
输出:
$ bash -x test_cd.sh
+ read -p 'Enter filename: ' fname
Enter filename: ~/Music
+ [[ -d ~/Music ]]
+ echo ' ~/Music is not a directory'
~/Music is not a directory