1
0
mirror of https://github.com/5im-0n/sshenc.sh.git synced 2025-08-02 11:20:05 +02:00

Remove mapfile use

- This makes it compatible with the version of BASH shipped with macOS
This commit is contained in:
Pete Woods
2020-08-28 12:48:54 +01:00
parent c3467c9760
commit b7c0dad242

View File

@@ -69,13 +69,12 @@ if [[ "${#github_handle[@]}" -gt 0 ]]; then
do do
curl -s "https://github.com/$handle.keys" | grep ssh-rsa > "$temp_dir/$handle" curl -s "https://github.com/$handle.keys" | grep ssh-rsa > "$temp_dir/$handle"
if [ -s "$temp_dir/$handle" ]; then if [ -s "$temp_dir/$handle" ]; then
# dont do this with big files key_index=0
mapfile -t handle_keys < "$temp_dir/$handle" while IFS= read -r key; do
for key in "${!handle_keys[@]}" printf "%s" "${key}" > "$temp_dir/$handle.$key_index"
do public_key+=("$temp_dir/$handle.$key_index")
printf "%s" "${handle_keys[key]}" > "$temp_dir/$handle.$key" key_index=$((key_index+1))
public_key+=("$temp_dir/$handle.$key") done < "$temp_dir/$handle"
done
fi fi
done done