minor fix

This commit is contained in:
Yan Lin 2025-12-09 01:53:42 +01:00
parent e1904b85d9
commit b1522d1554
2 changed files with 4 additions and 2 deletions

View file

@ -1,6 +1,7 @@
## Coding Style ## Coding Style
- Never write shebang unless specifically requested - Never write shebang unless specifically requested
- Do not abuse comments when writing code, especially code intuitive enough that does not need comments to further explain - Do not abuse comments when writing code, especially code intuitive enough that does not need comments to further explain
- When writing shell scripts, prefer zsh over bash; use `zsh -i -c` to run commands that need access to user-defined shell functions
## NixOS ## NixOS
- This is my nixOS configuration for all my personal computers, and you are running on one of the nixOS hosts - This is my nixOS configuration for all my personal computers, and you are running on one of the nixOS hosts

View file

@ -41,12 +41,13 @@ let
while [[ -s "$file" ]]; do while [[ -s "$file" ]]; do
cmd="$(head -n 1 "$file")" cmd="$(head -n 1 "$file")"
tail -n +2 "$file" > "$file.tmp" && mv "$file.tmp" "$file"
if [[ -n "$cmd" ]]; then if [[ -n "$cmd" ]]; then
eval "$cmd" zsh -i -c "$cmd"
fi fi
tail -n +2 "$file" > "$file.tmp" && mv "$file.tmp" "$file"
if [[ -s "$file" ]]; then if [[ -s "$file" ]]; then
sleep "$gap_seconds" sleep "$gap_seconds"
fi fi