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.
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.
Hi,
Below is what i have in my profile:
alias wldm='cd /opt/app/wls'
If i use bash or ksh shell this alias does not work.
What should be done for this alias to work with all these simultaneously -> No Shell, bash shell, and ksh shell (14 Replies)
Hello Friends,
I am facing problem in creating aliases.
I am working in SunOS 5.10. When I login in system i have been given ksh shell.
What i am doing is that ?
I am changing shell to bash then I am creating 2 alias in command prompt like:
alias deploy_dir=' cd... (4 Replies)
I'd like to create an alias that displays my string but leaves my cursor at the end.
Not seeing any examples of this.
One indirect way might be to preload or stuff the history buffer, so I just hit up arrow. (2 Replies)
I have a file named 'aliases' which contains a list of aliases like:
alias loc='locate'
alias h='history'
alias .='pwd'
alias ..='cd ..'
alias cd..='cd .. ; pwd'
..............................
Where should I put this file (alias) so when Terminal launches .bash and thus a shell at... (1 Reply)
None of the aliases that I set are available if I switch to a different shell.
How can I export aliases and make them available in any shell that I switch to like ksh or bash ?
I tried these
$>alias godata='cd /home/kc/app/data'
$>alias -x godata='cd /home/kc/app/data'
$>alias |... (2 Replies)
Hi.
I use an alias, "homeperm" as shorthand for curl -o. Since most of what I download via cUrl is graphic image files -- jpeg files -- I'd like to be able to change this alias to a script, or use it to invoke a function, which will not only download the file but date-stamp it using Exiv2 in... (4 Replies)
I'm trying to set up an alias in .bash_aliases to show just the filenames of the files in a directory, which the following command will do:
ls -l | grep ^- | awk '{print $NF}'
kjb.zip
ap.zip
tor.zip
However when I set up the following alias in .bash_aliases:
alias lf="ls -l | grep ^- |... (16 Replies)
Is it possible to create an alias wherein it will use a keystroke.
Like to clear the screen in bash i have to use CTRL + l.
I want to make an alias 'c' out of this.
Thanks. (6 Replies)
Hi All,
I am setting bash as my working shell in my .profile file.
So I have written a line :
bash
as the list line in my .profile
I want to use alias as follows:
alias me='who am i'
When i log in, as expeced I enter the bash shell but alias doesn't work.
Is it because the alias is defined... (1 Reply)