How to create parameterized aliases in bashrc
Hi I would like to create an alias to show Nth line of a file. I tried something like alias shline='head -$1 $2 | tail -1' #$1 is the line number and $2 is the filename # Usage should be : $shline 5 file.txt But it isn't working.. Can anyone suggest a better alternative Thanks Aman Jain
Re: How to create parameterized aliases in bashrc
Aman Jain wrote: > Hi > > I would like to create an alias to show Nth line of a file. > > I tried something like > alias shline='head -$1 $2 | tail -1' #$1 is the line number and $2 > is the filename ># Usage should be : > $shline 5 file.txt > > But it isn't working.. You can't pass parameters to aliases. > Can anyone suggest a better alternative Use a function. shline() { head -n $1 "$2" | tail -n 1; } -- D.
Re: kill job vs. pid
Daniel Norton <[EMAIL PROTECTED]> wrote: > How do I tell bash to kill job 1, rather than pid 1 ? man bash, in the section JOB CONTROL: # There are a number of ways to refer to a job in the shell. The # character % introduces a job name. Job number n may be referred to # as %n. A job may also be referred to using a prefix of the name # used to start it, or using a substring that appears in its command # line. For example, %ce refers to a stopped ce job. "kill %1" kills job 1; "kill 1" kills process 1. Chet: it would probably be helpful to change that second sentence to "The character % introduces a job name, or jobspec." "jobspec" isn't defined anywhere as fa r as I can see. paul