2021-03-07 00:09:00 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
SCRIPT=$(readlink -f "$0")
|
|
|
|
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
|
|
|
|
|
|
if test -n "$1"; then
|
|
|
|
FILE_PATH=$1
|
|
|
|
elif test ! -t 0; then
|
|
|
|
read -r FILE_PATH
|
|
|
|
else
|
|
|
|
>&2 echo "Provide a file"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
FILENAME=$(basename $FILE_PATH)
|
|
|
|
|
|
|
|
if file -i -b "$FILENAME" | grep "text" &> /dev/null; then
|
|
|
|
$SCRIPTPATH/nc-share-text.sh "$FILENAME"
|
2021-03-07 00:14:36 +00:00
|
|
|
elif file -i -b "$FILENAME" | grep "image" &> /dev/null; then
|
|
|
|
$SCRIPTPATH/nc-share-file.sh "$FILENAME" | awk '{print $1"/preview"}'
|
|
|
|
else
|
2021-03-07 00:09:00 +00:00
|
|
|
$SCRIPTPATH/nc-share-file.sh "$FILENAME"
|
|
|
|
fi
|
|
|
|
|