LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Alias command assistance to simplify (https://www.linuxquestions.org/questions/linux-newbie-8/alias-command-assistance-to-simplify-669107/)

norto 09-11-2008 01:38 AM

Alias command assistance to simplify
 
Hoping someone could assist.
I'm hoping to simplify a command that we are using to sniff our network.
Command is
java PacketReporter trace.n 10:15 10:30 > filename

trace.n being a changing value and the times being a changing value.
How can I simplify this without typing the whole line while being able to enter the variables of the trace.n and times?
trace.n is a file with packet information.

i92guboj 09-11-2008 01:55 AM

Quote:

Originally Posted by norto (Post 3276733)
Hoping someone could assist.
I'm hoping to simplify a command that we are using to sniff our network.
Command is
java PacketReporter trace.n 10:15 10:30 > filename

trace.n being a changing value and the times being a changing value.
How can I simplify this without typing the whole line while being able to enter the variables of the trace.n and times?
trace.n is a file with packet information.

This is more suitable for a function, in my opinion. In bash you could do

Code:

my_func () {
  java PacketReporter "$1" "$2" "$3" > filename
}

Put it in your ~/.bashrc and/or ~/.bash_profile, restart your bash session (i.e. exec bash) and now you should be able to just do

Code:

my_fync trace.n 10:15 10:30


All times are GMT -5. The time now is 02:37 AM.