How to use strace upon redirection?

Roland McGrath roland at redhat.com
Wed Aug 6 23:56:02 UTC 2003


> I'd like to use strace to see what shell will do for redirection.
> However it seems hard to achieve it.
> 
> For example: "#strace cat /etc/passwd >aaa"
> 
> Shell will make the redirection before execve "strace cat /etc/passwd"
> and ">aaa" is considered as parameter to shell, not to cat.

Perhaps by reading strace output you will learn how redirection really
works, which is not by passing strings such as ">aaa" to execve.

Try:
	$ strace sh -c 'cat /etc/passwd > aaa'





More information about the Strace-devel mailing list