mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-12-22 16:18:00 +00:00
Improve dexec function
This commit is contained in:
parent
2f5cd1cb23
commit
c74c597f30
9
.zshrc
9
.zshrc
@ -58,10 +58,15 @@ fzf-file-widget-hidden () {
|
||||
|
||||
dexec () {
|
||||
local cid
|
||||
local cmd=${1:-"bash"}
|
||||
local cmd=("$@")
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
cmd=(bash)
|
||||
fi
|
||||
|
||||
cid=$(docker ps -a | sed 1d | fzf -1 | awk '{print $1}')
|
||||
|
||||
[ -n "$cid" ] && docker exec -ti "$cid" $cmd
|
||||
[ -n "$cid" ] && docker exec -ti "$cid" "${cmd[@]}"
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user