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, Mar 4, 2008 at 1:12 PM, Mike Miller <EMAIL:PROTECTED> wrote:
>  Suppose you want to make a directory name that begins with "-".  Will this
>  work?
>
>  mkdir \-X
>
>  Nope.  A few days ago, I thought it would, but it doesn't.  This is where
>  the "--" argument comes in:
>
>  mkdir -- -X
>
>  That works.

Prefacing the directory with ./ also works:

$ mkdir ./-X

> The same trick works for "cd", so we're up to this:

Unfortunately, prepending ./ is not "generic" enough to work for cd.
Thus the need for '--'.

>  > 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".

Regards,
- Robert

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