Last active
February 11, 2025 03:47
-
-
Save davegallant/d717d0a6cd299999331d67ed7573ae19 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# pct-enter [container-name] | |
# If container-name is not provided, a fzf prompt will be displayed. | |
containers=$(pct list | tail -n +2 | awk '{print $3" - "$1}') | |
if [ $# -eq 0 ]; then | |
selected_container=$(echo "$containers" | fzf) | |
else | |
selected_container=$(echo "$containers" | grep "$1") | |
fi | |
if [ -z "$selected_container" ]; then | |
echo "No container selected." | |
exit 1 | |
fi | |
container_id=$(echo "$selected_container" | awk '{print $3}') | |
pct enter $container_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment