I try to determinate, if a given path points to a file or a directory. I tried this with following code:
#if $mypath is a file if [[ -f $mypath ]]; then
#if mypath is a directory if [[ -d $mypath ]]; then
Both of these snippets are working fine, when the given path is absolute e.g. /home/user/mydir/... But when the given path starts with a ~, like ~/mydir/... both of these snippets will return true, regardless if the path points to a file, or directory.
Does anybody know, what I'm missing, or if it's even possible?