• echo does not display from bash script

    From pinnerite@pinnerite@gmail.com to alt.os.linux.mint on Sat May 2 20:13:04 2026
    From Newsgroup: alt.os.linux.mint

    This is script. None of the echo lines display(?).

    #!/bin/bash

    LOGFILE="$HOME/myth_backup.log" TARGET="/media/alan/e06b3828-2ec7-493a-bfbc-dcdd04ac2fed"

    echo "Backup started at $(date)" >> "$LOGFILE"

    # Run MythTV backup
    #
    echo "Running mythconverg_backup.pl..." >> "$LOGFILE" /home/mythtv/mythconverg_backup.pl >> "$LOGFILE" 2>&1 || \
    echo "WARNING: mythconverg_backup.pl failed" >> "$LOGFILE"

    # Rsync backup
    echo "Starting rsync..." >> "$LOGFILE"

    if mountpoint -q "$TARGET"; then
    if rsync -avh --delete /home/mythtv/ "$TARGET"/ >> "$LOGFILE" 2>&1; then
    echo "Backup completed successfully at $(date)" >> "$LOGFILE"
    else
    echo "ERROR: rsync failed at $(date)" >> "$LOGFILE"
    fi
    else
    echo "ERROR: Backup target not mounted, skipping rsync" >> "$LOGFILE"
    fi

    TIA Alan
    --
    Linux Mint 21.3 kernel version 5.15.0-157-generic Cinnamon 6.0.4
    AMD Ryzen 7 7700, Radeon RX 6600, 32GB DDR5, 1TB SSD, 2TB Barracuda
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From pinnerite@pinnerite@gmail.com to alt.os.linux.mint on Tue May 5 21:39:24 2026
    From Newsgroup: alt.os.linux.mint

    On Sun, 3 May 2026 13:00:51 +0100
    Mark Bourne <nntp.mbourne@spamgourmet.com> wrote:

    Paul wrote:
    Let us work with this one.

    somecommand >> "$LOGFILE" 2>&1

    That says to redirect "stderr" to "stdout",
    then redirect "stdout" additively to the $LOGFILE.
    Nowhere does it mention anything about also
    including a copy on Alans Screen :-)

    How about if we try this ?

    somecommand 2>&1 | tee >> "$LOGFILE"

    I think you need:

    somecommand 2>&1 | tee --append "$LOGFILE"

    Otherwise you're redirecting the copy that tee sends to stdout to the
    file instead (so you still won't get any output on the terminal), and
    not giving tee any files to copy it to.

    --
    Mark.

    I rebuilt the 13 year-old machine and while doing it the penny droped.
    The existing data data isbeing copied from the hard drive to the NVMe
    as I write. Once the teething problems are over, I will bring up some
    quick and dirty scripts to just grubby.

    Thank you for your help.
    Alan
    --
    Linux Mint 22.1 kernel version 6.8.0-84-generic Cinnamon 6.4.8
    AMD Ryzen 7 7700, Radeon RX 6600, 32GB DDR5, 2TB SSD, 2TB Barracuda
    --- Synchronet 3.21f-Linux NewsLink 1.2