I often find myself running a series of commands on a single set of arguments.
For example:
$ nmap -Pn -sS 192.168.1.5
$ ssh 192.168.1.5
$ curl 192.168.1.5
$ wget -r 192.168.1.5
This can be sped up by putting the argument(s) in a variable,
$ a=192.168.1.5
$ nmap -Pn -sS $a
$ ssh $a
$ curl $a
$ wget -r $a
and sped up even more by using a couple of functions such as the following.
$ more .zshrc
...
paa() { PERSIST_ARGS+=("$@"); }
pa() { eval "$@" "${PERSIST_ARGS[@]}"; }
...
$ paa 192.168.1.5
$ pa nmap -Pn -sS
$ pa ssh
$ pa curl
$ pa wget -r
Is there a way to speed this up even more? For example,
$ <start special mode> 192.168.1.5
$ nmap -Pn -sS
$ ssh
$ curl
$ wget -r
$ <exit special mode>
I am looking for bash
or zsh
solutions. The solution has to work with an arbitrary set of commands.