bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A request for addition of a command


From: Jim Meyering
Subject: Re: A request for addition of a command
Date: Fri, 24 Jul 2009 09:15:56 +0200

Kamil Dudka wrote:

> Hello Tak,
>
> On Friday 24 of July 2009 00:17:07 Tak Ota wrote:
>> As a part of file name manipulation commands, in addition to the
>> current three commands (basename, dirname, pathchk) could you consider
>> introduction of a generic path name manipulation command?  See
>> attached example.
>
> did you considered use of canonicalize_file_name() from gnulib (also available
> in glibc)? It can manage many of operations implemented in your code. The
> function operates on ordinary C strings. The most frequently operation in
> your example is concatenation which is AFAIK trivial operation in all shells.
> So maybe we can do most of this by combining shell string concatenation and
> canonicalization.
>
> I am not sure what is the semantic of "negative paths". Should it cut
> prefix/postfix of the path? Or am I missing something?
>
>> The need of this type of command can be satisfied by combination of
>> other commands such as sed and awk but it is quite cumbersome as the
>> operation is frequently required in writhing Makefiles and shell
>> scripts in software development.
>
> Actually I don't know if we have some utility equivalent to
> canonicalize_file_name() function in coreutils now.

We do.  It's called readlink:

Usage: readlink [OPTION]... FILE
Display value of a symbolic link on standard output.

  -f, --canonicalize            canonicalize by following every symlink in
                                every component of the given name recursively;
                                all but the last component must exist
  -e, --canonicalize-existing   canonicalize by following every symlink in
                                every component of the given name recursively,
                                all components must exist
  -m, --canonicalize-missing    canonicalize by following every symlink in
                                every component of the given name recursively,
                                without requirements on components existence
  -n, --no-newline              do not output the trailing newline
  -q, --quiet,
  -s, --silent                  suppress most error messages
  -v, --verbose                 report error messages
      --help     display this help and exit
      --version  output version information and exit

Report readlink bugs to address@hidden
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]