MLUG: Re: [MLUG] shell script - find shell script parent directory?
Re: [MLUG] shell script - find shell script parent directory?
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Tue, 4 Mar 2008, Robert Citek wrote:

Prefacing the directory with ./ also works:

$ mkdir ./-X

Good one. I didn't think of that.


Can you over-ride that from happening? In any case, a horrible hack would be to parse the output of "which", which should report that these are built-ins. Note: I don't have a appropriate test bed here at work for any of this.

Actually, "which" wouldn't be enough as it doesn't distinguish between builtin commands, functions, and aliases. Thus the need for "builtin".

I looked into "which" a little bit. It's pretty comlicated. There are a number of options. There is also the command "type" -- you often really need to use "type" instead of which.


Anyway, "which" can work for the script we've been working on but it seems that we need GNU which without these options to get a full path:

--show-dot --show-tilde

GNU on Solaris won't give the full path. That's why we abandoned use of "which" in favor of cd with pwd. Being able to use the builtins is nice because then you should be fully system independent and you'll only have to worry about bash version (maybe).

Mike

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members