0

maybe this is a total noob question. But I do not know how to use this. For example when I have 'stat' I can use 'stat /home/'. But when I type stat() a new Line starting with '> ' comes up. Can anyone tell me what to do with that? I am just curious because there is lstat (man lstat) but I cannot use it - System won't find it. But there is lstat().

Maybe you can help me to resolve this or to ask the question some better. (Reformatting welcomed as well I know I suck in those things)

Edit: I noticed you can type anything before brackets and it will start with the new line I said above.

2 Answers 2

1

Don't confuse a system call with an executable wrapper around that call. For instance, see man 2 stat for documentation about the system call named stat, and man 1 stat (or simply man stat) for documentation about the command stat that uses the system call to provide information about the requested files.

The shell does not provide direct access to system calls; its purpose is to run other programs.

When you type stat() at a shell prompt, you begin a shell function definition. The > indicates that the shell is waiting for the rest of the definition. For example:

$ foo()
> { echo hello; }
$ foo
hello
Sign up to request clarification or add additional context in comments.

Comments

1

In bash, the syntax stat() starts the definition of a function called stat. You don't call functions that way in a shell, just use the same syntax as for commands defined on the path.

lstat is listed in the man page as lstat(2), meaning the man page is in section 2 of man pages. That section is for OS calls from a program, not for shell commands. Try checking out the SYNOPSIS part of a man page to see how to use things: If there is a #include line, you can be pretty sure it's for C programmers.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.