mirror of https://github.com/tstack/lnav.git
[example files]: fix shellcheck identified issues
This commit is contained in:
parent
1bd81ec630
commit
03fd7cc52d
|
@ -1,13 +1,13 @@
|
||||||
#! /bin/sh
|
#!/bin/sh
|
||||||
# Wrapper for various clipboard I/O on Linux desktop environments and Windows emulations thereof
|
# Wrapper for various clipboard I/O on Linux desktop environments and Windows emulations thereof
|
||||||
|
|
||||||
if [ -z "$STDIN_COPY_COMMAND" ] || [ -z "$STDOUT_PASTE_COMMAND" ]
|
if [ -z "$STDIN_COPY_COMMAND" ] || [ -z "$STDOUT_PASTE_COMMAND" ]
|
||||||
then
|
then
|
||||||
if [ $WAYLAND_DISPLAY ]
|
if [ -n "$WAYLAND_DISPLAY" ]
|
||||||
then
|
then
|
||||||
STDIN_COPY_COMMAND="wl-copy --foreground --type text/plain"
|
STDIN_COPY_COMMAND="wl-copy --foreground --type text/plain"
|
||||||
STDOUT_PASTE_COMMAND="wl-paste --no-newline"
|
STDOUT_PASTE_COMMAND="wl-paste --no-newline"
|
||||||
elif [ $DISPLAY ]
|
elif [ -n "$DISPLAY" ]
|
||||||
then
|
then
|
||||||
if command -v xclip
|
if command -v xclip
|
||||||
then
|
then
|
||||||
|
@ -34,7 +34,7 @@ then
|
||||||
then
|
then
|
||||||
STDIN_COPY_COMMAND="clip.exe"
|
STDIN_COPY_COMMAND="clip.exe"
|
||||||
STDOUT_PASTE_COMMAND=":"
|
STDOUT_PASTE_COMMAND=":"
|
||||||
elif [ $TMUX ]
|
elif [ -n "$TMUX" ]
|
||||||
then
|
then
|
||||||
STDIN_COPY_COMMAND="tmux load-buffer -"
|
STDIN_COPY_COMMAND="tmux load-buffer -"
|
||||||
STDOUT_PASTE_COMMAND="tmux save-buffer -"
|
STDOUT_PASTE_COMMAND="tmux save-buffer -"
|
||||||
|
@ -44,7 +44,7 @@ then
|
||||||
fi > /dev/null
|
fi > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$1" in
|
case $1 in
|
||||||
copy) exec $STDIN_COPY_COMMAND > /dev/null 2>/dev/null ;;
|
copy) exec $STDIN_COPY_COMMAND > /dev/null 2>/dev/null ;;
|
||||||
paste) exec $STDOUT_PASTE_COMMAND < /dev/null 2>/dev/null ;;
|
paste) exec $STDOUT_PASTE_COMMAND < /dev/null 2>/dev/null ;;
|
||||||
"") # Try to guess intention
|
"") # Try to guess intention
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#
|
#
|
||||||
# An example script that converts messages in a syslog file into a
|
# An example script that converts messages in a syslog file into a
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
#
|
#
|
||||||
# NOTE: lnav is going to save some state in $HOME; you might want to change
|
# NOTE: lnav is going to save some state in $HOME; you might want to change
|
||||||
# $HOME to something else...
|
# $HOME to something else...
|
||||||
#
|
#
|
||||||
# NOTE 2: Unfortunately, this is pretty inefficient right now since lnav
|
# NOTE 2: Unfortunately, this is pretty inefficient right now since lnav
|
||||||
# is going to store the entire log file in memory when processing the
|
# is going to store the entire log file in memory when processing the
|
||||||
# result of the SQL SELECT.
|
# result of the SQL SELECT.
|
||||||
|
@ -29,19 +29,19 @@ fi
|
||||||
out_file_base=$(basename "$1")
|
out_file_base=$(basename "$1")
|
||||||
counter=0
|
counter=0
|
||||||
while test -e "${out_file_base}.${counter}.csv"; do
|
while test -e "${out_file_base}.${counter}.csv"; do
|
||||||
counter=`expr ${counter} + 1`
|
counter=$((counter + 1))
|
||||||
done
|
done
|
||||||
export OUT_FILE="${out_file_base}.${counter}.csv"
|
export OUT_FILE="${out_file_base}.${counter}.csv"
|
||||||
|
|
||||||
# Here's a quick summary of what this is doing:
|
# Here's a quick summary of what this is doing:
|
||||||
#
|
#
|
||||||
# 1. ':load-session' will load the session data which stores which lines
|
# 1. ':load-session' will load the session data which stores which lines
|
||||||
# are bookmarked in a file. We're using bookmarks to keep track of the
|
# are bookmarked in a file. We're using bookmarks to keep track of the
|
||||||
# last line that we converted in a previous run of this script.
|
# last line that we converted in a previous run of this script.
|
||||||
# 2. ';CREATE TABLE helper' creates a temporary table that we use to store
|
# 2. ';CREATE TABLE helper' creates a temporary table that we use to store
|
||||||
# the range of messages that we'll be converting.
|
# the range of messages that we'll be converting.
|
||||||
# 3. ';INSERT INTO helper' will figure out the range of lines in syslog file
|
# 3. ';INSERT INTO helper' will figure out the range of lines in syslog file
|
||||||
# to convert.
|
# to convert.
|
||||||
# 4. ';UPDATE syslog_log' will set a bookmark on the last line of the range
|
# 4. ';UPDATE syslog_log' will set a bookmark on the last line of the range
|
||||||
# we computed in the previous step.
|
# we computed in the previous step.
|
||||||
# 5. ';SELECT *' will pull all of the log messages in the computed range.
|
# 5. ';SELECT *' will pull all of the log messages in the computed range.
|
||||||
|
|
Loading…
Reference in New Issue