Skip to content

Instantly share code, notes, and snippets.

@dilworks
Created March 29, 2015 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dilworks/52cf6de4145b771361f4 to your computer and use it in GitHub Desktop.
Save dilworks/52cf6de4145b771361f4 to your computer and use it in GitHub Desktop.
Worst spaces-in-paths workaround for Steam/primusrun ever
#!/bin/bash
echo "CMD: $@"
echo "ARGS: $#"
BASEPATH=""
if [ -f "$1" ]
then
echo "Valid at 1"
BASEPATH=$1
shift
else
if [ -f "$1 $2" ]
then
echo "Valid at 2"
BASEPATH="$1 $2"
shift
shift
else
if [ -f "$1 $2 $3" ]
then
echo "Valid at 3"
BASEPATH="$1 $2 $3"
shift
shift
shift
else
echo "Give up..."
exit 1
fi
fi
fi
echo $BASEPATH
echo "ARGS now: $@"
primusrun "$BASEPATH" "$@"
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment