-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andre MARQUEZ
committed
Jul 25, 2017
1 parent
889f52c
commit 0e670f1
Showing
2 changed files
with
44 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# **************************************************************************** # | ||
# # | ||
# ::: :::::::: # | ||
# close_port.sh :+: :+: :+: # | ||
# +:+ +:+ +:+ # | ||
# By: amarquez <[email protected]> +#+ +:+ +#+ # | ||
# +#+#+#+#+#+ +#+ # | ||
# Created: 2017/07/25 18:06:36 by amarquez #+# #+# # | ||
# Updated: 2017/07/25 18:50:15 by amarquez ### ########.fr # | ||
# # | ||
# **************************************************************************** # | ||
|
||
## number pattern | ||
|
||
re='^[0-9]+$' | ||
|
||
## ask for port number | ||
|
||
printf "PORT #: "; | ||
|
||
## assign port number | ||
|
||
read -p "" port | ||
|
||
## check if valid port number | ||
|
||
if [ "$port" -eq "$port" ] 2>/dev/null; then | ||
|
||
# get output from lsof ( including PID ) | ||
|
||
lsof="$(lsof -i :$port)" | ||
|
||
printf "$lsof"; | ||
|
||
else | ||
|
||
# not a valid port number | ||
|
||
printf "error: not a valid port number"; | ||
|
||
fi |
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