-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add open_link script to allow us open a link in all platforms from Ma…
…kefile or any script
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# Opens a link with the default browser of OS (It works cross-platform) | ||
# | ||
## You can call it like `open_link balad.ir` to open balad website on your default browser | ||
open_link () { | ||
case "$(uname -s)" in | ||
Darwin) | ||
# macOS | ||
open "$1" | ||
;; | ||
|
||
Linux) | ||
# Linux: | ||
xdg-open "$1" | ||
;; | ||
|
||
CYGWIN*|MINGW32*|MSYS*|MINGW*) | ||
# Windows | ||
start "$1" | ||
;; | ||
|
||
*) | ||
echo 'Not supported OS' | ||
;; | ||
esac | ||
} |