Create share.sh

This commit is contained in:
Anthony Wang 2021-07-21 15:39:53 +00:00 committed by GitHub
parent 35177003cd
commit 56b69db576
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

14
share.sh Normal file
View file

@ -0,0 +1,14 @@
#!/bin/sh
# Get IP address
echo "Your IP address is "$(ip route get 1.1.1.1 | grep -oP 'src \K[^ ]+')
if [ "$#" -ne 1 ]; then
ln $1 . # Link file to current directory
else
xdg-open share.txt # Open file in default editor
fi
# Start Python's HTTP server
echo "Press Ctrl-C to stop the server when you are done"
python -m http.server