What does `LOGFILE=$1:-/var/log/syslog` do?How to use syslog for else output ( show up with whois - query )?What does set -e do?What does this “printf” command do?“file /var/log/syslog is being edited” message in nanoscript does not write to file when executed from cronCron job log reads 'No MTA installed', does that prevent the CRON job from finishing?Direct all output to logfileWhat does “$@” do in a bash script?What does “exec 1>/var/opt/log/my_logs/MYPROG_`date '+%Y%m%d_%H%M%S'`.log 2>&1” do?Resume script does nothing

Passport queue length in UK in relation to arrival method

Caught with my phone during an exam

What was the primary motivation for a historical figure like Xenophon to create an extensive collection of written material?

What is the required burn to keep a satellite at a Lagrangian point?

Team member is vehemently against code formatting

Why is unzipped file smaller than zipped file

Is it normal to "extract a paper" from a master thesis?

Is there any mention of ghosts who live outside the Hogwarts castle?

Why is 'additive' EQ more difficult to use than 'subtractive'?

If I arrive in the UK, and then head to mainland Europe, does my Schengen visa 90 day limit start when I arrived in the UK, or mainland Europe?

How could the B-29 bomber back up under its own power?

How could Dwarves prevent sand from filling up their settlements

What does it mean when みたいな is at the end of a sentence?

How to make Flex Markers appear in Logic Pro X?

How to test if argument is a single space?

why "American-born", not "America-born"?

What is this dime sized black bug with white on the segments near Loveland Colorodao?

Download app bundles from App Store to run on iOS Emulator on Mac

Surface of the 3x3x3 cube as a graph

To exponential digit growth and beyond!

mmap: effect of other processes writing to a file previously mapped read-only

Gas chromatography flame ionization detector (FID) - why hydrogen gas?

Can someone get a spouse off a deed that never lived together and was incarcerated?

Which values for voltage divider



What does `LOGFILE=$1:-/var/log/syslog` do?


How to use syslog for else output ( show up with whois - query )?What does set -e do?What does this “printf” command do?“file /var/log/syslog is being edited” message in nanoscript does not write to file when executed from cronCron job log reads 'No MTA installed', does that prevent the CRON job from finishing?Direct all output to logfileWhat does “$@” do in a bash script?What does “exec 1>/var/opt/log/my_logs/MYPROG_`date '+%Y%m%d_%H%M%S'`.log 2>&1” do?Resume script does nothing






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I stumbled across this script containing:



LOGFILE=$1:-/var/log/syslog


What does this line do?










share|improve this question






















  • Close enough IMO, heemayl’s answer explains thoroughly what the pattern with and without : does. If you don’t think the explanation suffices, maybe edit the answer over there? With 13 UVs on the question and 19 on the answer I think it’s save to say that this is our generic post for this particular parameter expansion, and we don’t really need to split things up even more – one post covering parameter expansion in general would be nice.

    – dessert
    7 hours ago

















3















I stumbled across this script containing:



LOGFILE=$1:-/var/log/syslog


What does this line do?










share|improve this question






















  • Close enough IMO, heemayl’s answer explains thoroughly what the pattern with and without : does. If you don’t think the explanation suffices, maybe edit the answer over there? With 13 UVs on the question and 19 on the answer I think it’s save to say that this is our generic post for this particular parameter expansion, and we don’t really need to split things up even more – one post covering parameter expansion in general would be nice.

    – dessert
    7 hours ago













3












3








3








I stumbled across this script containing:



LOGFILE=$1:-/var/log/syslog


What does this line do?










share|improve this question














I stumbled across this script containing:



LOGFILE=$1:-/var/log/syslog


What does this line do?







command-line bash






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 7 hours ago









WinEunuuchs2UnixWinEunuuchs2Unix

50.5k12100195




50.5k12100195












  • Close enough IMO, heemayl’s answer explains thoroughly what the pattern with and without : does. If you don’t think the explanation suffices, maybe edit the answer over there? With 13 UVs on the question and 19 on the answer I think it’s save to say that this is our generic post for this particular parameter expansion, and we don’t really need to split things up even more – one post covering parameter expansion in general would be nice.

    – dessert
    7 hours ago

















  • Close enough IMO, heemayl’s answer explains thoroughly what the pattern with and without : does. If you don’t think the explanation suffices, maybe edit the answer over there? With 13 UVs on the question and 19 on the answer I think it’s save to say that this is our generic post for this particular parameter expansion, and we don’t really need to split things up even more – one post covering parameter expansion in general would be nice.

    – dessert
    7 hours ago
















Close enough IMO, heemayl’s answer explains thoroughly what the pattern with and without : does. If you don’t think the explanation suffices, maybe edit the answer over there? With 13 UVs on the question and 19 on the answer I think it’s save to say that this is our generic post for this particular parameter expansion, and we don’t really need to split things up even more – one post covering parameter expansion in general would be nice.

– dessert
7 hours ago





Close enough IMO, heemayl’s answer explains thoroughly what the pattern with and without : does. If you don’t think the explanation suffices, maybe edit the answer over there? With 13 UVs on the question and 19 on the answer I think it’s save to say that this is our generic post for this particular parameter expansion, and we don’t really need to split things up even more – one post covering parameter expansion in general would be nice.

– dessert
7 hours ago










1 Answer
1






active

oldest

votes


















3














The command: LOGFILE=$1:-/var/log/syslog is shorthand for:



if [[ "$1" == "" ]] # if parameter 1 is blank
then
LOGFILE="/var/log/syslog" # LOGFILE set to /var/log/syslog
else
LOGFILE="$1" # LOGFILE set to parameter 1
fi


If parameter 1 is not passed you see:



yad-logfile 1.png



If you pass paraemeter 1:



journalctl -b > /tmp/messages
yad-logfile /tmp/messages


you see:



yad-logfile 2.png




The original code in question link was modified:



#!/bin/bash

# NAME: yad-logfile
# DATE: May 19, 2019.

# From: https://sourceforge.net/p/yad-dialog/wiki/LogViewer/

# This script demonstrates new features of list dialog. Script displays content
# of specified log file and mark some special strings: with word "kernel" by
# setting italic font, with word "error" by light yellow background and with
# word "warn" by pink background

LOGFILE=$1:-/var/log/syslog

PARSER='font=""; color="#FFFFFF";
/CRON/ font="italic";
/smartd/ color="#FFF4B8";
/upower/ color="#FFD0D8";
OFS="n" print $1 " " $2, $3, $4, substr($5,0,index($5,":")-1),
substr($0,index($0,$6)), font, color; fflush()'

cat $LOGFILE | awk "$PARSER" |
yad --title="Log viewer" --window-icon=logviewer
--button=gtk-close --geometry 600x350
--list --text="Content of $LOGFILE"
--column Date --column Time --column Host
--column Tag --column Message:TIP
--column @font@ --column @back@

exit $?





share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1144591%2fwhat-does-logfile-1-var-log-syslog-do%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    The command: LOGFILE=$1:-/var/log/syslog is shorthand for:



    if [[ "$1" == "" ]] # if parameter 1 is blank
    then
    LOGFILE="/var/log/syslog" # LOGFILE set to /var/log/syslog
    else
    LOGFILE="$1" # LOGFILE set to parameter 1
    fi


    If parameter 1 is not passed you see:



    yad-logfile 1.png



    If you pass paraemeter 1:



    journalctl -b > /tmp/messages
    yad-logfile /tmp/messages


    you see:



    yad-logfile 2.png




    The original code in question link was modified:



    #!/bin/bash

    # NAME: yad-logfile
    # DATE: May 19, 2019.

    # From: https://sourceforge.net/p/yad-dialog/wiki/LogViewer/

    # This script demonstrates new features of list dialog. Script displays content
    # of specified log file and mark some special strings: with word "kernel" by
    # setting italic font, with word "error" by light yellow background and with
    # word "warn" by pink background

    LOGFILE=$1:-/var/log/syslog

    PARSER='font=""; color="#FFFFFF";
    /CRON/ font="italic";
    /smartd/ color="#FFF4B8";
    /upower/ color="#FFD0D8";
    OFS="n" print $1 " " $2, $3, $4, substr($5,0,index($5,":")-1),
    substr($0,index($0,$6)), font, color; fflush()'

    cat $LOGFILE | awk "$PARSER" |
    yad --title="Log viewer" --window-icon=logviewer
    --button=gtk-close --geometry 600x350
    --list --text="Content of $LOGFILE"
    --column Date --column Time --column Host
    --column Tag --column Message:TIP
    --column @font@ --column @back@

    exit $?





    share|improve this answer



























      3














      The command: LOGFILE=$1:-/var/log/syslog is shorthand for:



      if [[ "$1" == "" ]] # if parameter 1 is blank
      then
      LOGFILE="/var/log/syslog" # LOGFILE set to /var/log/syslog
      else
      LOGFILE="$1" # LOGFILE set to parameter 1
      fi


      If parameter 1 is not passed you see:



      yad-logfile 1.png



      If you pass paraemeter 1:



      journalctl -b > /tmp/messages
      yad-logfile /tmp/messages


      you see:



      yad-logfile 2.png




      The original code in question link was modified:



      #!/bin/bash

      # NAME: yad-logfile
      # DATE: May 19, 2019.

      # From: https://sourceforge.net/p/yad-dialog/wiki/LogViewer/

      # This script demonstrates new features of list dialog. Script displays content
      # of specified log file and mark some special strings: with word "kernel" by
      # setting italic font, with word "error" by light yellow background and with
      # word "warn" by pink background

      LOGFILE=$1:-/var/log/syslog

      PARSER='font=""; color="#FFFFFF";
      /CRON/ font="italic";
      /smartd/ color="#FFF4B8";
      /upower/ color="#FFD0D8";
      OFS="n" print $1 " " $2, $3, $4, substr($5,0,index($5,":")-1),
      substr($0,index($0,$6)), font, color; fflush()'

      cat $LOGFILE | awk "$PARSER" |
      yad --title="Log viewer" --window-icon=logviewer
      --button=gtk-close --geometry 600x350
      --list --text="Content of $LOGFILE"
      --column Date --column Time --column Host
      --column Tag --column Message:TIP
      --column @font@ --column @back@

      exit $?





      share|improve this answer

























        3












        3








        3







        The command: LOGFILE=$1:-/var/log/syslog is shorthand for:



        if [[ "$1" == "" ]] # if parameter 1 is blank
        then
        LOGFILE="/var/log/syslog" # LOGFILE set to /var/log/syslog
        else
        LOGFILE="$1" # LOGFILE set to parameter 1
        fi


        If parameter 1 is not passed you see:



        yad-logfile 1.png



        If you pass paraemeter 1:



        journalctl -b > /tmp/messages
        yad-logfile /tmp/messages


        you see:



        yad-logfile 2.png




        The original code in question link was modified:



        #!/bin/bash

        # NAME: yad-logfile
        # DATE: May 19, 2019.

        # From: https://sourceforge.net/p/yad-dialog/wiki/LogViewer/

        # This script demonstrates new features of list dialog. Script displays content
        # of specified log file and mark some special strings: with word "kernel" by
        # setting italic font, with word "error" by light yellow background and with
        # word "warn" by pink background

        LOGFILE=$1:-/var/log/syslog

        PARSER='font=""; color="#FFFFFF";
        /CRON/ font="italic";
        /smartd/ color="#FFF4B8";
        /upower/ color="#FFD0D8";
        OFS="n" print $1 " " $2, $3, $4, substr($5,0,index($5,":")-1),
        substr($0,index($0,$6)), font, color; fflush()'

        cat $LOGFILE | awk "$PARSER" |
        yad --title="Log viewer" --window-icon=logviewer
        --button=gtk-close --geometry 600x350
        --list --text="Content of $LOGFILE"
        --column Date --column Time --column Host
        --column Tag --column Message:TIP
        --column @font@ --column @back@

        exit $?





        share|improve this answer













        The command: LOGFILE=$1:-/var/log/syslog is shorthand for:



        if [[ "$1" == "" ]] # if parameter 1 is blank
        then
        LOGFILE="/var/log/syslog" # LOGFILE set to /var/log/syslog
        else
        LOGFILE="$1" # LOGFILE set to parameter 1
        fi


        If parameter 1 is not passed you see:



        yad-logfile 1.png



        If you pass paraemeter 1:



        journalctl -b > /tmp/messages
        yad-logfile /tmp/messages


        you see:



        yad-logfile 2.png




        The original code in question link was modified:



        #!/bin/bash

        # NAME: yad-logfile
        # DATE: May 19, 2019.

        # From: https://sourceforge.net/p/yad-dialog/wiki/LogViewer/

        # This script demonstrates new features of list dialog. Script displays content
        # of specified log file and mark some special strings: with word "kernel" by
        # setting italic font, with word "error" by light yellow background and with
        # word "warn" by pink background

        LOGFILE=$1:-/var/log/syslog

        PARSER='font=""; color="#FFFFFF";
        /CRON/ font="italic";
        /smartd/ color="#FFF4B8";
        /upower/ color="#FFD0D8";
        OFS="n" print $1 " " $2, $3, $4, substr($5,0,index($5,":")-1),
        substr($0,index($0,$6)), font, color; fflush()'

        cat $LOGFILE | awk "$PARSER" |
        yad --title="Log viewer" --window-icon=logviewer
        --button=gtk-close --geometry 600x350
        --list --text="Content of $LOGFILE"
        --column Date --column Time --column Host
        --column Tag --column Message:TIP
        --column @font@ --column @back@

        exit $?






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 7 hours ago









        WinEunuuchs2UnixWinEunuuchs2Unix

        50.5k12100195




        50.5k12100195



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1144591%2fwhat-does-logfile-1-var-log-syslog-do%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Log på Navigationsmenu

            Wonderful Copenhagen (sang) Eksterne henvisninger | NavigationsmenurSide på frankloesser.comWonderful Copenhagen

            Detroit Tigers Spis treści Historia | Skład zespołu | Sukcesy | Członkowie Baseball Hall of Fame | Zastrzeżone numery | Przypisy | Menu nawigacyjneEncyclopedia of Detroit - Detroit TigersTigers Stadium, Detroit, MITigers Timeline 1900sDetroit Tigers Team History & EncyclopediaTigers Timeline 1910s1935 World Series1945 World Series1945 World Series1984 World SeriesComerica Park, Detroit, MI2006 World Series2012 World SeriesDetroit Tigers 40-Man RosterDetroit Tigers Coaching StaffTigers Hall of FamersTigers Retired Numberse