I try the following alias:
alias psx='ps auxw | grep $1 | grep -v grep'
but it fails with "grep: yyy: No such file or directory" (for 'psx yyy' command).
the following is ok:
alias psx='ps auxw | grep $1'
An alias cannot have an argument like $1. You want to use a function instead.
psx () {
ps auxw | grep "$1" | grep -v grep
}
Your second alias works by coincidence when $1 is empty in the current shell (as it will often be in an interactive bash); it expands to ps auxw | grep (empty string) yyy -- and ironically, if you had double-quoted $1 properly, it would also not have worked.
Your first alias expands to ps auxw | grep (empty string) | grep -v grep yyy
Search these forums for ways to avoid the grep -v grep elegantly; solutions have been posted a number of times.