Skip to content

Commit 7a1b7cb

Browse files
authored
Merge pull request #53 from tomty89/app_995
termux-share: companion of termux/termux-api#253
2 parents a6e432b + 689e3f9 commit 7a1b7cb

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

scripts/termux-share

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,13 @@ shift $(($OPTIND-1))
4242
if [ $# -gt 1 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
4343

4444
if [ $# != 0 ]; then
45-
FILE="$1"
46-
if [ -f "$FILE" ]; then
47-
FILE=`realpath "$FILE"`
45+
if [ ! -f "$1" ]; then
46+
echo "$1 is not a file"
47+
exit 1
4848
fi
4949

50-
# Fix for issues on Android 8.1.
51-
FILE=$(echo "$FILE" | sed 's/^\///')
52-
5350
# Note that the file path can contain whitespace.
54-
/data/data/com.termux/files/usr/libexec/termux-api Share $PARAMS --es file "$FILE"
51+
/data/data/com.termux/files/usr/libexec/termux-api Share $PARAMS --es file "$(realpath "$1")"
5552
else
5653
/data/data/com.termux/files/usr/libexec/termux-api Share $PARAMS
5754
fi

0 commit comments

Comments
 (0)