:: Re: [DNG] type
Top Pagina
Delete this message
Reply to this message
Auteur: dvalin
Datum:  
Aan: dng
Onderwerp: Re: [DNG] type
xOn 16.02.25 18:48, Alessandro Vesely via Dng wrote:

> On Sun 16/Feb/2025 10:57:59 +0100 Erik Christiansen via Dng wrote:


> > alias which='type -a'    # Checks aliases & functions also.


> >


> > improved matters without losing linguistic rationality.


>


>


> I like better how which works, for PATH commands, as it avoids full


> sentences and just print the name(s).  One can type:


>


>     which whatever


>


> and then, for example:


>


>     file `!!`


Nice ... when the command is an executable.

It is when the command is a built-in, alias, or shell function, that "which" offers nothing, however. Maybe alias it to run "type -a" when it fails to find?

Here it is useful to be reminded that I have hacked xpdf's borking on filenames with spaces, with an automatic space substituting rename. (That's handy for PDFs snarfed off the web.)

$ which xpdf

xpdf is a function

xpdf ()

{

if [[ $1 =~ ' ' ]]; then

fn=${1// /_};

mv "$1" $fn;

else

fn=$1;

fi;

/usr/bin/xpdf -geometry 1200x900+5+0 -z width -papercolor wheat3 $fn &

}

xpdf is /usr/bin/xpdf

Erik