Skip to content

Commit

Permalink
Added support files with spaces in alias mode
Browse files Browse the repository at this point in the history
  • Loading branch information
salman-abedin committed Jul 23, 2020
1 parent c40a732 commit 75341fd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions devour.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/bin/sh
#
# Hides your terminal window before launching an external program and unhides it after quitting.
# Dependencies: sed, xdo
# Usage: devour CMD/ALIAS...
# devour CMD/ALIAS... -- [FILE with spaces]

WID=$(xdo id)

ARGS=$*
CMD="${ARGS%% --*}"
FILE="${ARGS##*-- }"
SAFEFILE=$(echo "$FILE" | sed 's/ /\\ /g')

$SHELL -i -c "xdo hide
echo $* >> ~/Downloads/d
echo ($*) >> ~/Downloads/d
$* > /dev/null 2>&1
$CMD $SAFEFILE > /dev/null 2>&1
xdo show $WID
exit"

0 comments on commit 75341fd

Please sign in to comment.