Johan Hendriks
2016-Mar-10 18:12 UTC
output to file different than console. (ssh and zfs )
Hello all. I use a script to get a list of snapshots from a remote machine. If I run it on the console it gives me the following. root at storage1:/ # ssh root at storage2.server.mydomain.com /sbin/zfs list -H -o name -t snapshot | grep 15min_ | sort storage/home/datadir1 at 15min_2016-03-09_22.20.00--1h storage/home/datadir2 at 15min_2016-03-09_22.20.00--1h storage/home/datadir3 at 15min_2016-03-09_22.20.00--1h storage/home/datadir4 at 15min_2016-03-09_22.20.00--1h root at storage1:/ # As you see the output shows the zfs snapshots of the remote server. I need this to to into a file so I can grep, sed and do other things with it. If I put the output to a file than the name of the remote machine is in that file. ( I see this on my 10.2 machines, not on my 9.x machines.) root at storage1:/ # ssh root at storage2.server.mydomain.com /sbin/zfs list -H -o name -t snapshot | grep 15min_ | sort > /tmp/zfs-remote-snapshot root at storage1:/ # vi /tmp/zfs-remote-snapshot ^[]0;storage2.server.mydomain.com^Gstorage/home/datadir1 at 15min_2016-03-09_22.20.00--1h storage/home/datadir2 at 15min_2016-03-09_22.20.00--1h storage/home/datadir3 at 15min_2016-03-09_22.20.00--1h storage/home/datadir4 at 15min_2016-03-09_22.20.00--1h I have no idea why the hostname is in the file. Is there an option I should give to ssh or something. Like I said, on FreeBSD 9.x I do not see this. Thanks for your time. regards Johan
Brandon Allbery
2016-Mar-10 18:18 UTC
output to file different than console. (ssh and zfs )
On Thu, Mar 10, 2016 at 1:12 PM, Johan Hendriks <joh.hendriks at gmail.com> wrote:> ^[]0;storage2.server.mydomain.com > > ^Gstorage/home/datadir1 at 15min_2016-03-09_22.20.00--1h > storage/home/datadir2 at 15min_2016-03-09_22.20.00--1h > storage/home/datadir3 at 15min_2016-03-09_22.20.00--1h > storage/home/datadir4 at 15min_2016-03-09_22.20.00--1h >The ^[ .. ^G stuff is trying to write the hostname to a terminal emulator's status bar. Check for the shell on that machine having some kind of precmd (zsh) / $PROMPT_FUNCTION (bash) or just an echo like that in its dotfiles. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net