kiss: readlink(), run in subshell

This commit is contained in:
Dylan Araps 2020-05-02 10:00:59 +03:00
parent 881c6114b9
commit f10cdb1938
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 2 additions and 3 deletions

5
kiss
View File

@ -145,7 +145,7 @@ decompress() {
esac < "$1" esac < "$1"
} }
readlink() { readlink() (
# This is a 'readlink' utility written with POSIX utilities. # This is a 'readlink' utility written with POSIX utilities.
# 'ls' is used to obtain the target of the symlink. # 'ls' is used to obtain the target of the symlink.
# #
@ -186,9 +186,8 @@ readlink() {
# where a file may include ' -> ' in its name. # where a file may include ' -> ' in its name.
[ -e "$target" ] || target=$PWD/${1##*/} [ -e "$target" ] || target=$PWD/${1##*/}
cd - >/dev/null
printf '%s\n' "$target" printf '%s\n' "$target"
} )
sha256sum() { sha256sum() {
# This is an implementation of 'sha256sum' using openssl/libressl. # This is an implementation of 'sha256sum' using openssl/libressl.