[Israel.pm] Cwd::abs_path and "~"
Shlomi Fish
shlomif at iglu.org.il
Wed Feb 11 07:46:11 PST 2004
On Wednesday 11 February 2004 16:24, Offer Kaye wrote:
> Hi,
> I'm trying to pass a path containing the tilda "~" sign in the beginning to
> Cwd's abs_path fuction, but I get back undef instead of the full path:
>
> use Cwd qw(abs_path);
> my $full_path = abs_path("~/some/path") or die "Couldn't resolve path\n";
>
~ is not a real pathname. In C-shell and many other shells (tcsh, bash, zsh,
etc.) it is an alias for the environment variable $HOME. The correct syntax
would be:
abs_path("$ENV{HOME}/some/path");
Regards,
Shlomi Fish
--
---------------------------------------------------------------------
Shlomi Fish shlomif at iglu.org.il
Homepage: http://t2.technion.ac.il/~shlomif/
I don't believe in fairies. Oops! A fairy died.
I don't believe in fairies. Oops! Another fairy died.
More information about the Perl
mailing list