bash - How to redirect part of standard output from a shell command -


i have below shell commands generate ssh key , add public key authorized keys. but, want redirect out put of command file while have prompt generated these commands enter output.

ssh-keygen -f /home/$cu/.ssh/${ssh_key}_rsa -t rsa -n '' # add public key authorized keys ssh-copy-id -i /home/$cu/.ssh/${ssh_key}_rsa.pub $linux_user@$linux_machine 

could please provide suggestions.

the answer looking command called tee split stream 2. although can complicated it, common use write file while letting streams still print out normal looking for.

ssh-keygen -f /home/$cu/.ssh/${ssh_key}_rsa -t rsa -n '' | tee -a $log_file  ssh-copy-id -i /home/$cu/.ssh/${ssh_key}_rsa.pub $linux_user@$linux_machine | tee -a $log_file 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -