SPUG: Fixing Cygwin broken links
Michael R. Wolf
MichaelRWolf at att.net
Fri Jul 22 07:28:33 PDT 2005
> And I didn't use -w. I know, I'm bad.
And just to be a bit safe (anal, possibly), I like to use an absolute path
in my shebang line.
#! /usr/bin/perl -w
Something about horses and Troy.... :-)
BTW -- I remember Damian talking (a few years ago in his ~damian/bin talk,
originally given to SPUG, then later expanded at OSCON) about setting up a
macro in vi (as an emacs user, myself, I don't remember the exact details)
that inserted this shebang line for him. Personally, I haven't gotten lazy
(the virtue) enough to create such a keybinding in emacs, but I do incant
that magic.
> $ perl -lwe 'use Fcntl ":mode"; $x=S_IFREG; print $x'
> 32768
More obvious (to those who don't remember all their powers of 2)
if printed as a binary mask....
||||
VVVV
$ perl -lwe 'use Fcntl ":mode"; $x=S_IFREG; printf "%b", $x'
1000000000000000
Thanks for the example. I had forgotten (or didn't even know in the first
place) that $mode includes the permission bits *AND* the file type bits.
More information about the spug-list
mailing list