mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-04-24 12:46:53 +08:00
dogo/doll
dogo supports zsh/bash/sh; doll is introduced to launch a new docker container; update $SUDO in command.sh
This commit is contained in:
parent
995899f3a3
commit
6937ba8447
|
@ -4,7 +4,7 @@ THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
|||
source "$THIS_DIR/../tools/common.sh"
|
||||
|
||||
if [[ -z "$1" || "$1" =~ "-h|--help" ]]; then
|
||||
fmt_info "usage: dogo <container>"
|
||||
fmt_info "usage: $0 <container>"
|
||||
else
|
||||
$SUDO docker exec -it $1 zsh
|
||||
$SUDO docker exec -it $1 sh -c 'if [ -x "$(command -v zsh)" ]; then zsh; elif [ -x "$(command -v bash)" ]; then echo "-->bash"; bash; else echo "-->sh"; sh; fi'
|
||||
fi
|
||||
|
|
10
scripts/doll
Executable file
10
scripts/doll
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
source "$THIS_DIR/../tools/common.sh"
|
||||
|
||||
if [[ -z "$1" || "$1" =~ "-h|--help" ]]; then
|
||||
fmt_info "usage: $0 <image>"
|
||||
else
|
||||
$SUDO docker run -itd $1 sh
|
||||
fi
|
|
@ -4,7 +4,7 @@ THIS_DIR_COMMON_SH=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
|||
export DOTFILES=$( cd "$THIS_DIR_COMMON_SH/.." && pwd )
|
||||
|
||||
SUDO=''
|
||||
if (( $EUID != 0 )); then
|
||||
if [[ "$EUID" != "0" && -x $(command -v sudo) ]]; then
|
||||
SUDO='sudo'
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user