-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from SBU-BMI/develop
Develop
- Loading branch information
Showing
7 changed files
with
372 additions
and
71 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
.vscode/settings.json | ||
quip.code-workspace |
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
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,30 @@ | ||
#--------------------------------------------------- | ||
# File: Helper Function Library | ||
#--------------------------------------------------- | ||
|
||
#--------------------------------------------------- | ||
# Function: chk_opt | ||
# Description: Takes an argument and determines if it | ||
# is a flag instead of an parameter value. | ||
# parameters: cl argument | ||
# usage: opterr="$(chk_opt ${2})" | ||
#--------------------------------------------------- | ||
function chk_opt() { | ||
# Check the first char of the option passed | ||
checkc="$(echo $1 | head -c 1)" | ||
|
||
if [ $checkc == "-" ] | ||
then | ||
echo 'true' | ||
else | ||
echo 'false' | ||
fi | ||
} | ||
#----------------------------------------------------------------------- | ||
# End chk_opt | ||
#----------------------------------------------------------------------- | ||
|
||
|
||
#----------------------------------------------------------------------- | ||
# end functions | ||
#----------------------------------------------------------------------- |
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,64 @@ | ||
#--------------------------------------------------- | ||
# File: ReadPass Function Library | ||
#--------------------------------------------------- | ||
|
||
#--------------------------------------------------- | ||
# Function: getPrompt | ||
# Description: Read a line of input hile echoing on | ||
# the screen. | ||
# parameters: prompt | ||
# usage: myvar="$(getPrompt 'prompt')" | ||
#--------------------------------------------------- | ||
function getPrompt() { | ||
prompt="$1 " | ||
read -p "$prompt" input | ||
echo "$input" | ||
} | ||
#--------------------------------------------------- | ||
# End getPrompt | ||
#--------------------------------------------------- | ||
|
||
#--------------------------------------------------- | ||
# Function: getPass | ||
# Description: Read a line of input while showing '*' | ||
# on the screen. | ||
# parameters: prompt | ||
# usage: myPW="$(getPass 'prompt')" | ||
#--------------------------------------------------- | ||
function getPass() { | ||
prompt="$1 " | ||
# Loop to get all characters of the password | ||
while IFS= read -p "$prompt" -r -s -n 1 char | ||
do | ||
# Check if the return key was pressed | ||
if [[ $char == $'\0' ]]; then | ||
break | ||
fi | ||
# Check to see if backspace was pressed | ||
if [[ $char == $'\177' ]]; then | ||
l=${#password} # length of password | ||
# if l is > 0 then delete last char | ||
# else do not remove any character | ||
if [[ l -gt 0 ]] | ||
then | ||
prompt=$'\b \b' | ||
password="${password%?}" | ||
else | ||
prompt=$'' | ||
fi | ||
else | ||
# Add new char to password | ||
prompt='*' | ||
password+="$char" | ||
fi | ||
done | ||
# Echo out password to be able to capture | ||
echo "$password" | ||
} | ||
#--------------------------------------------------- | ||
# End getPass | ||
#--------------------------------------------------- | ||
|
||
#--------------------------------------------------- | ||
# End Function Library | ||
#--------------------------------------------------- |
Oops, something went wrong.