Re: [SLE] $PATH issue



Randall R Schulz wrote:
Jos, Sergey,

On Sunday 05 March 2006 05:01, Jos van Kan wrote:
Sergey Mkrtchyan wrote:
People,
being a root, I do the following

linux:~ # export PATH=

Now as I understand it mustn't understand any command, because
there is nowhere for him to find for that commands, but he frelly
does ls, echo, and others, but don't do for example su, cfdisk...

Can you explain me what's wrong, and do I understand correctly the
meaning of the PATH?
Nothing is wrong: cd, ls, echo (and many others) are shell built ins
and will always work, regardless of the value of $PATH. (man bash).

The "ls" command certainly is not built into BASH.

To discover whether a command is implemented as a built-in (some are
both built-ins and external commands), use the BASH "type" command (a
built-in, obviously):

% help type
type: type [-afptP] name [name ...]
For each NAME, indicate how it would be interpreted if used as a
command name.

If the -t option is used, `type' outputs a single word which is one of
`alias', `keyword', `function', `builtin', `file' or `', if NAME is an
alias, shell reserved word, shell function, shell builtin, disk file,
or unfound, respectively.

If the -p flag is used, `type' either returns the name of the disk
file that would be executed, or nothing if `type -t NAME' would not
return `file'.

If the -a flag is used, `type' displays all of the places that contain
an executable named `file'. This includes aliases, builtins, and
functions, if and only if the -p flag is not also used.

The -f flag suppresses shell function lookup.

The -P flag forces a PATH search for each NAME, even if it is an alias,
builtin, or function, and returns the name of the disk file that would
be executed.

% type help
help is a shell builtin

% type type
type is a shell builtin

% type cd
cd is a shell builtin

% type ls
ls is hashed (/bin/ls)


The type built-in will identify external commands, built-ins, aliases
and shell procedures.


Jos van Kan


Randall Schulz


Thanks Randall, thanks Jos
I learned much more new

--
Sergey Mkrtchyan
Scientific Researcher
Department of Molecular Physics,
Faculty of Physics, Yerevan State University
Tel: (374-10) 55-43-41
Fax: (374-10) 57-76-89

--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-faq@xxxxxxxx



Relevant Pages

  • Re: [SLE] $PATH issue
    ... cd, ls, echo are shell built ins ... The "ls" command certainly is not built into BASH. ... alias, shell reserved word, shell function, shell builtin, disk file, ... If the -a flag is used, `type' displays all of the places that contain ...
    (SuSE)
  • Re: Command to cause a loop
    ... or the shell builtin c-like for construct: ... Use printf "%02d" $m inside the construct to pad it there. ... a built-in command is almost as slow as calling an external command ...
    (comp.unix.shell)
  • Re: executing a script - pls help
    ... > Whenever I attempt to execute a script at the command prompt nothing ... test is a shell builtin ... ...there's also an external command named test. ...
    (alt.os.linux)
  • re-define type command
    ... I would like to change the operation of a "shell builtin" command - type. ... Is there a way to make an alias or a function which overrides it? ... I know I can make a new command like "xtype" to do what I want. ...
    (comp.unix.shell)
  • Re: Bash operator performance: test [...] vs. extended test [[...]]
    ... The difference is more on the syntax. ... "[" is a shell builtin ... command, parsed as any other command, and then an internal ... > globbing features of the extended test operator, ...
    (comp.unix.shell)