-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: tools: scripts: red-pill: Add option to select user
Signed-off-by: Patrick José Pereira <[email protected]>
- Loading branch information
1 parent
1b33f65
commit c853b16
Showing
1 changed file
with
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,38 @@ | ||
#!/bin/bash | ||
|
||
usage() { | ||
echo "Usage: $0 [-h] [-u user]" | ||
echo | ||
echo " -h, Show this help message" | ||
echo " -u, Define a user (default: pi)" | ||
exit 1 | ||
} | ||
|
||
# Default values | ||
user="pi" | ||
|
||
while getopts ":hu:" opt; do | ||
case ${opt} in | ||
h ) | ||
usage | ||
;; | ||
u ) | ||
user=$OPTARG | ||
;; | ||
\? ) | ||
echo "Invalid Option: -$OPTARG" 1>&2 | ||
usage | ||
;; | ||
: ) | ||
echo "Invalid Option: -$OPTARG requires an argument" 1>&2 | ||
usage | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND -1)) | ||
|
||
echo "You took the red pill." | ||
echo "You stay in Wonderland, and I show you how deep the rabbit hole goes." | ||
echo "Remember, all I'm offering is the truth. Nothing more." | ||
echo "Exiting from docker, welcome to the real world." | ||
ssh -i /root/.config/.ssh/id_rsa -o StrictHostKeyChecking=no pi@localhost | ||
ssh -i /root/.config/.ssh/id_rsa -o StrictHostKeyChecking=no $user@localhost |