Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #173816

Re: bash NEWBIE I/O and I/O redirection problems

From "Thomas Schmitt" <scdbackup@gmx.net>
Newsgroups linux.debian.user
Subject Re: bash NEWBIE I/O and I/O redirection problems
Date 2016-10-25 11:30 +0200
Message-ID <sw6dr-3Ia-13@gated-at.bofh.it> (permalink)
References <sw4lj-2sj-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

it comes to me that there is a better way to make the redirection via "tee"
less ugly in the code. It does not depend on the assumption that the log
file path is a single word.

First define in the script:

  # Shell function which lets "tee" consume its standard input
  my_log() {
    tee -i -a "$HOME/my_logfile"
  }

Then use it in the same script like
 
    echo "Block count: "$blocks | my_log


Have a nice day :)

Thomas

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

bash NEWBIE I/O and I/O redirection problems Richard Owlett <rowlett@cloud85.net> - 2016-10-25 04:30 +0200
  Re: bash NEWBIE I/O and I/O redirection problems "der.hans" <deb-user@LuftHans.com> - 2016-10-25 05:10 +0200
    Re: bash NEWBIE I/O and I/O redirection problems "Thomas Schmitt" <scdbackup@gmx.net> - 2016-10-25 09:30 +0200
      Re: bash NEWBIE I/O and I/O redirection problems "Thomas Schmitt" <scdbackup@gmx.net> - 2016-10-25 11:30 +0200
    Re: bash NEWBIE I/O and I/O redirection problems Richard Owlett <rowlett@cloud85.net> - 2016-10-25 14:20 +0200
  Re: bash NEWBIE I/O and I/O redirection problems <tomas@tuxteam.de> - 2016-10-25 11:30 +0200
    Re: bash NEWBIE I/O and I/O redirection problems Richard Owlett <rowlett@cloud85.net> - 2016-10-25 14:20 +0200
  Re: bash NEWBIE I/O and I/O redirection problems Greg Wooledge <wooledg@eeg.ccf.org> - 2016-10-25 14:10 +0200

csiph-web