[gull] on topic : printf interne de bash
felix
felix at f-hauri.ch
Wed Mar 19 18:08:42 CET 2014
On Tue, Mar 18, 2014 at 06:45:31PM +0100, dc wrote:
> On 18/03/2014 16:39, Felipe Gonzalez wrote:
>
> >comment dans un script bash indiquer que l'on veut la commande interne
> >bash et pas l'executable externe ?
>
> Bash execute en premier les fonctions internes à bash. la commande
> /usr/bin/printf ne sera donc pas exécutée à moins de le préciser.
Oui,
mais on avais vu:
http://forum.linux-gull.ch/pipermail/gull/2012-November/013776.html
Pour s'assurer que l'on va bien executer la commande ``builtin'' et non une
fonction, on peut lancer:
command cd
ou
builtin cd
En fait la différence est subtile:
builtin shell-builtin [arguments]
Execute the specified shell builtin, passing it arguments, and
return its exit status. This is useful when defining a function
whose name is the same as a shell builtin, retaining the func‐
tionality of the builtin within the function. The cd builtin is
commonly redefined this way. The return status is false if
shell-builtin is not a shell builtin command.
command [-pVv] command [arg ...]
Run command with args suppressing the normal shell function
lookup. Only builtin commands or commands found in the PATH are
executed. If the -p option is given, the search for command is
performed using a default value for PATH that is guaranteed to
find all of the standard utilities. If either the -V or -v
option is supplied, a description of command is printed. The -v
option causes a single word indicating the command or file name
used to invoke command to be displayed; the -V option produces a
more verbose description. If the -V or -v option is supplied,
the exit status is 0 if command was found, and 1 if not. If
neither option is supplied and an error occurred or command can‐
not be found, the exit status is 127. Otherwise, the exit sta‐
tus of the command builtin is the exit status of command.
> C'est exactement la mème chose que pour 'test'.
>
> dc
>
> _______________________________________________
> gull mailing list
> gull at forum.linux-gull.ch
> http://forum.linux-gull.ch/mailman/listinfo/gull
--
Félix
More information about the gull
mailing list