Eu usaria apenas uma função simples. Adicione isto ao seu arquivo ~/.bashrc
:
function runcom(){
echo "$@"
## Run the command
$@
}
Agora, sempre que você quiser executar um comando e imprimi-lo, você pode fazer:
runcom apt-cache depends kde-window-manager > out
O acima produz este arquivo:
$ cat out
apt-cache depends kde-window-manager
kde-window-manager
Depends: perl
Depends: kde-runtime
Depends: kde-style-oxygen
Depends: libc6
|Depends: libegl1-mesa
Depends: <libegl1-x11>
libegl1-mesa
Depends: libgcc1
|Depends: libgl1-mesa-glx
Depends: <libgl1>
libgl1-mesa-swx11
libgl1-mesa-glx
|Depends: libgles2-mesa
Depends: <libgles2>
libgles2-mesa
Depends: libice6
Depends: libkactivities6
Depends: libkcmutils4
Depends: libkdeclarative5
Depends: libkdecorations4abi2
Depends: libkdecore5
Depends: libkdeui5
Depends: libkio5
Depends: libknewstuff3-4
Depends: libkwineffects1abi5
Depends: libkwinglesutils1
Depends: libkwinglutils1abi2
Depends: libkworkspace4abi2
Depends: libplasma3
Depends: libqt4-dbus
Depends: libqt4-declarative
Depends: libqt4-script
Depends: libqtcore4
Depends: libqtgui4
Depends: libsm6
Depends: libstdc++6
Depends: libwayland-client0
|Depends: libwayland-egl1-mesa
Depends: <libwayland-egl1>
libwayland-egl1-mesa
Depends: libx11-6
Depends: libx11-xcb1
Depends: libxcb-composite0
Depends: libxcb-damage0
Depends: libxcb-image0
Depends: libxcb-keysyms1
Depends: libxcb-randr0
Depends: libxcb-render0
Depends: libxcb-shape0
Depends: libxcb-shm0
Depends: libxcb-sync1
Depends: libxcb-xfixes0
Depends: libxcb-xtest0
Depends: libxcb1
Depends: libxcursor1
Depends: libxext6
Depends: libxrandr2
Depends: libxxf86vm1
Breaks: kde-style-bespin
Breaks: kde-style-bespin:i386
Breaks: <kde-style-skulpture>
Breaks: <kde-style-skulpture:i386>
Breaks: kde-workspace-data
Breaks: <kde-workspace-data:i386>
Breaks: kdeartwork-theme-window
Breaks: kdeartwork-theme-window:i386
Breaks: <kdebase-workspace-data>
Breaks: <kdebase-workspace-data:i386>
Breaks: kwin-style-crystal
Breaks: kwin-style-crystal:i386
Breaks: kwin-style-dekorator
Breaks: kwin-style-dekorator:i386
Breaks: kwin-style-qtcurve
Breaks: kwin-style-qtcurve:i386
Replaces: kde-workspace-data
Replaces: <kde-workspace-data:i386>
Replaces: <kdebase-workspace-data>
Replaces: <kdebase-workspace-data:i386>
Conflicts: kde-window-manager:i386