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
size of pointers and architecture
Why did Nick Fury not hesitate in blowing up the plane he thought was carrying a nuke?
Is it OK to look at the list of played moves during the game to determine the status of the 50 move rule?
If a character has cast the Fly spell on themselves, can they "hand off" to the Levitate spell without interruption?
Proto-Indo-European (PIE) words with IPA
why "American-born", not "America-born"?
Make the `diff` command look only for differences from a specified range of lines
If change in free energy (G) is positive, how do those reactions still occur?
Are there historical examples of audiences drawn to a work that was "so bad it's good"?
Ratings matrix plot
Why is this integration method not valid?
Is it normal to "extract a paper" from a master thesis?
What is the true cause of time dilation? Velocity, momentum or energy?
"Official wife" or "Formal wife"?
mmap: effect of other processes writing to a file previously mapped read-only
A nasty indefinite integral
How to become an Editorial board member?
Three knights or knaves, three different hair colors
What is the required burn to keep a satellite at a Lagrangian point?
Way of refund if scammed?
Are there any tips to help hummingbirds find a new feeder?
How do I write real-world stories separate from my country of origin?
Why is this python script running in background consuming 100 % CPU?
Illustrating that universal optimality is stronger than sphere packing
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;
I stumbled across this script containing:
LOGFILE=$1:-/var/log/syslog
What does this line do?
command-line bash
add a comment |
I stumbled across this script containing:
LOGFILE=$1:-/var/log/syslog
What does this line do?
command-line bash
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
add a comment |
I stumbled across this script containing:
LOGFILE=$1:-/var/log/syslog
What does this line do?
command-line bash
I stumbled across this script containing:
LOGFILE=$1:-/var/log/syslog
What does this line do?
command-line bash
command-line bash
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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:
If you pass paraemeter 1:
journalctl -b > /tmp/messages
yad-logfile /tmp/messages
you see:
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 $?
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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:
If you pass paraemeter 1:
journalctl -b > /tmp/messages
yad-logfile /tmp/messages
you see:
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 $?
add a comment |
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:
If you pass paraemeter 1:
journalctl -b > /tmp/messages
yad-logfile /tmp/messages
you see:
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 $?
add a comment |
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:
If you pass paraemeter 1:
journalctl -b > /tmp/messages
yad-logfile /tmp/messages
you see:
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 $?
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:
If you pass paraemeter 1:
journalctl -b > /tmp/messages
yad-logfile /tmp/messages
you see:
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 $?
answered 7 hours ago
WinEunuuchs2UnixWinEunuuchs2Unix
50.5k12100195
50.5k12100195
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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