This is easiest done using /etc/ssh_config or .ssh/config. The format of the file is:

Host
  SSHConfigKeyword parameters...

You can list specific host names or use * to apply configuration to all hosts you plan to connect to.

The file below will forward TCP ports 8887,8888 and 8889.

Host *
    GatewayPorts yes
    RemoteForward *:8887 localhost:8887
    RemoteForward *:8888 localhost:8888
    RemoteForward *:8889 localhost:8889

Using the config file avoids using a really long command line for ssh. This file is either ~/.ssh/config or /etc/ssh_config. If the file does have the right syntax ssh will fail silently. If nothing is listening on the local port, a warning message is issued indicating the ports are not forwarded.