Created
July 21, 2016 08:07
-
-
Save zaltoprofen/f66da83627322688f0c1835cab641161 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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