Fix(ssh-agent): Use "command" for reliable file type detection

The "file" command was not working reliably in some environments. Using "command file" ensures consistent behavior across different systems.
This commit is contained in:
mikhailde 2024-10-14 22:13:21 +03:00
commit f37ee4e881

View file

@ -45,7 +45,7 @@ function _add_identities() {
# Iterate over files in .ssh folder.
for file in "$HOME/.ssh"/*; do
# Check if file is a valid private key using file magic.
if [[ -f "$file" && $(file -b "$file") == *"private key"* ]]; then
if [[ -f "$file" && $(command file -b "$file") == *"private key"* ]]; then
# Add filename (without path) to identities array.
identities+=("${file##*/}")
fi