Debian Codegraph @

pkg/users/ssh-list-public-keys.sh

raw
1 #!/bin/sh
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3
4 dir=$(mktemp -d)
5 cd "$dir"
6
7 process()
8 {
9 if [ -z "$1" ]; then
10 return
11 fi
12 case "$1" in
13 \#*)
14 ;;
15 *)
16 echo "$1"> authorized_keys
17 echo "$(LC_ALL=C ssh-keygen -l -f authorized_keys)"
18 echo "$1"
19 ;;
20 esac
21 }
22
23 sed -e '$a\' | while read -r line; do
24 process "$line"
25 done
26
27 rm -f "$dir/authorized_keys"
28 rmdir "$dir"