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 | |
parent | 2a6847d7e40cfdb5b8715a0b84b6ee84a0a27098 (diff) | |
download | aur-424353078085841af4ce9ecc54dfa5831fe1e533.tar.gz |
shellchecked and fixed realpath and DISPLAY var test
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 2 | ||||
-rwxr-xr-x | up | 18 |
3 files changed, 7 insertions, 15 deletions
@@ -10,7 +10,7 @@ pkgbase = upaste optdepends = xclip: Command line interface to the X11 clipboard source = up source = UNLICENSE - sha256sums = 4e668585d0424b86aa98f7349177339966955adb1aeb39ca34205c468d5b3c1c + sha256sums = 4775536bcc695a19e1559fbed27479a309d062cae8f1cd3fd125fb8ed1eec012 sha256sums = 6b0382b16279f26ff69014300541967a356a666eb0b91b422f6862f6b7dad17e pkgname = upaste @@ -11,7 +11,7 @@ optdepends=('wl-clipboard: Command-line copy/paste utilities for Wayland', depends=('curl') source=("up" "UNLICENSE") -sha256sums=("4e668585d0424b86aa98f7349177339966955adb1aeb39ca34205c468d5b3c1c" +sha256sums=("4775536bcc695a19e1559fbed27479a309d062cae8f1cd3fd125fb8ed1eec012" "6b0382b16279f26ff69014300541967a356a666eb0b91b422f6862f6b7dad17e") package() { @@ -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 |