diff --git a/bun/README.md b/bun/README.md index 89f0699e7..dd7c74240 100644 --- a/bun/README.md +++ b/bun/README.md @@ -134,7 +134,7 @@ file) ```sh sudo env PATH="$PATH" \ serviceman add --path="$PATH" --system \ - --username "$(whoami)" --name my-project -- \ + --username "$(id -u -n)" --name my-project -- \ bun run ./my-project.js ``` 4. Restart the logging service diff --git a/fish/README.md b/fish/README.md index 2e27699ef..7e672da94 100644 --- a/fish/README.md +++ b/fish/README.md @@ -43,7 +43,7 @@ the file: ```sh #!/bin/bash -echo "Who am I? I'm $(whoami)." +echo "Who am I? I'm $(id -u -n)." ``` You can also run bash explicitly: @@ -99,7 +99,7 @@ You should use `chsh` to change your shell: ```sh #!/bin/sh -sudo chsh -s "$(command -v fish)" "$(whoami)" +sudo chsh -s "$(command -v fish)" "$(id -u -n)" ``` If vim uses `fish` instead of `bash`, annoying errors will happen. diff --git a/go/README.md b/go/README.md index f3a0a5168..68b415a79 100644 --- a/go/README.md +++ b/go/README.md @@ -81,7 +81,7 @@ pushd ./hello/ # swap 'hello' and './hello' for the name of your project and binary sudo env PATH="$PATH" \ - serviceman add --system --username "$(whoami)" --name hello -- \ + serviceman add --system --username "$(id -u -n)" --name hello -- \ ./hello # Restart the logging service diff --git a/golang/README.md b/golang/README.md index 1bc0e0939..8c064775c 100644 --- a/golang/README.md +++ b/golang/README.md @@ -86,7 +86,7 @@ pushd ./hello/ # swap 'hello' and './hello' for the name of your project and binary sudo env PATH="$PATH" \ - serviceman add --system --username "$(whoami)" --name hello -- \ + serviceman add --system --username "$(id -u -n)" --name hello -- \ ./hello # Restart the logging service diff --git a/postgres/README.md b/postgres/README.md index a26feefd8..ecfa72d3e 100644 --- a/postgres/README.md +++ b/postgres/README.md @@ -37,7 +37,7 @@ Run as a system service on Linux: ```sh sudo env PATH="$PATH" \ - serviceman add --system --username "$(whoami)" --name postgres -- \ + serviceman add --system --username "$(id -u -n)" --name postgres -- \ postgres -D "$HOME/.local/share/postgres/var" -p 5432 # Restart the logging service diff --git a/ssh-adduser/ssh-adduser b/ssh-adduser/ssh-adduser index 83c946182..f4d0d8ea1 100644 --- a/ssh-adduser/ssh-adduser +++ b/ssh-adduser/ssh-adduser @@ -10,7 +10,7 @@ main() { my_key_url="${2:-}" my_keys="" - if [ "root" != "$(whoami)" ]; then + if [ "root" != "$(id -u -n)" ]; then echo "webi adduser: running user is already a non-root user" exit 0 fi diff --git a/ssh-pubkey/README.md b/ssh-pubkey/README.md index 84d2e134c..768f073d1 100644 --- a/ssh-pubkey/README.md +++ b/ssh-pubkey/README.md @@ -61,7 +61,7 @@ folder: ```sh rsync -av "$HOME/.ssh/id_rsa.pub" \ - "$HOME/Downloads/id_rsa.$(whoami).pub" + "$HOME/Downloads/id_rsa.$(id -u -n).pub" ``` How to print your public key to the Terminal: diff --git a/ssh-pubkey/ssh-pubkey b/ssh-pubkey/ssh-pubkey index 61ab2281a..f7ace425d 100755 --- a/ssh-pubkey/ssh-pubkey +++ b/ssh-pubkey/ssh-pubkey @@ -82,11 +82,11 @@ main() { # TODO use the comment (if any) for the name of the file echo >&2 "" #shellcheck disable=SC2088 - echo >&2 "~/Downloads/id_${my_keytype}.$(whoami).pub": + echo >&2 "~/Downloads/id_${my_keytype}.$(id -u -n).pub": echo >&2 "" - rm -f "$HOME/Downloads/id_${my_keytype}.$(whoami).pub" - cp -RPp "$HOME/.ssh/id_${my_keytype}.pub" "$HOME/Downloads/id_${my_keytype}.$(whoami).pub" - cat "$HOME/Downloads/id_${my_keytype}.$(whoami).pub" + rm -f "$HOME/Downloads/id_${my_keytype}.$(id -u -n).pub" + cp -RPp "$HOME/.ssh/id_${my_keytype}.pub" "$HOME/Downloads/id_${my_keytype}.$(id -u -n).pub" + cat "$HOME/Downloads/id_${my_keytype}.$(id -u -n).pub" echo >&2 "" if test -f ~/.ssh/id_rsa; then