Skip to content

Instantly share code, notes, and snippets.

@zaltoprofen
Created July 21, 2016 08:07
Show Gist options
  • Save zaltoprofen/f66da83627322688f0c1835cab641161 to your computer and use it in GitHub Desktop.
Save zaltoprofen/f66da83627322688f0c1835cab641161 to your computer and use it in GitHub Desktop.
#!/bin/bash
this=$0
if [ $# -ne 1 ];then
echo $this http://...
echo Download specified resource and open with VSCode
exit 1
fi
if ! which code >/dev/null; then
echo "\`code' command is not found. please install vscode and install \`code' command in PATH"
exit 1
fi
ext=.${1##*.}
if [ .$1 == $ext ];then
ext=''
fi
temp=$(mktemp -t temp)$ext
if ! curl -o $temp $1; then
echo "Error occured in downloading. aborting script"
exit 1
fi
code $temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment