diff options
author | eoli3n | 2020-11-16 18:55:13 +0100 |
---|---|---|
committer | eoli3n | 2020-11-16 18:55:13 +0100 |
commit | 424353078085841af4ce9ecc54dfa5831fe1e533 (patch) | |
tree | 20bb2e5d44b7a1ccd919a9dd8f010d009a467166 /up | |
parent | 2a6847d7e40cfdb5b8715a0b84b6ee84a0a27098 (diff) | |
download | aur-424353078085841af4ce9ecc54dfa5831fe1e533.tar.gz |
shellchecked and fixed realpath and DISPLAY var test
Diffstat (limited to 'up')
-rwxr-xr-x | up | 18 |
1 files changed, 5 insertions, 13 deletions
@@ -36,11 +36,6 @@ EOF upload () { - # Set vars - local args - local ext - local file - # If extension is set with -t option, set curl ext if [ -n "$extension" ] then @@ -50,7 +45,7 @@ upload () { if [ -z "$1" ] then # If argument is empty, upload stdin - local file="file=@-" + file="file=@-" # If curl ext not set, set it to .txt if [ -z "$ext" ] @@ -60,7 +55,7 @@ upload () { else # Else upload filename - local file="file=@\"$1\"" + file="file=@\"$1\"" fi args="$file;$ext" @@ -71,7 +66,7 @@ upload () { autocopy () { # If xorg or wayland is running - if [ -n 'DISPLAY' ] + if [ -n "$DISPLAY" ] then # If xclip is installed if which xclip >/dev/null 2>&1 @@ -87,7 +82,7 @@ autocopy () { is_file () { # Test if first argument is an existing file - if [ ! -f "$(readlink $1)" ] + if [ ! -f "$(realpath "$1")" ] then echo "File \"$1\" does not exist or is not a regular file" exit 2 @@ -96,9 +91,6 @@ is_file () { main () { - # Vars - local url - # If no piped data if [ -t 0 ] then @@ -147,7 +139,7 @@ while getopts "hat:" arg do case $arg in a) - AUTOCOPY=0 + autocopy=0 ;; h) usage |