Closed yarikoptic closed 2 weeks ago
I disagree. The problem is that the shell script was not written correctly to expand the ~
itself. Paths passed to programs should already have tildes expanded; it should be the caller's responsibility, not the program's, to expand them.
learning something new each day
❯ git config -f "~/.gitconfig" user.name
❯ git config -f '~/.gitconfig' user.name
❯ git config -f ~/.gitconfig user.name
Yaroslav Halchenko
❯ ~/bin/printargs ~/.gitconfig
>/home/yoh/.gitconfig<
❯ ~/bin/printargs "~/.gitconfig"
>~/.gitconfig<
❯ cat ~/bin/printargs
#!/bin/bash
for a in "$@"; do
echo ">$a<"
done
damn shell (zsh here) assumes that unquoted ~
is indeed part of the path and should be expanded -- didn't know :-/
(dev3) yoh@typhon:/mnt/DATA/data/yoh/BIDSonym$ gduct echo op duct is executing echo op... Log files will be written to ~/.cache/duct/reports/2024.06.10T21.44.08-3518040_ op
Exit Code: 0 Command: echo op Log files location: ~/.cache/duct/reports/2024.06.10T21.44.08-3518040_ Wall Clock Time: 0.052 sec Memory Peak Usage: unknown% CPU Peak Usage: unknown%
(dev3) yoh@typhon:/mnt/DATA/data/yoh/BIDSonym$ ls -ld ~/.cache/duct/reports/2024.06.10T21.44.08-3518040* ls: cannot access '/home/yoh/.cache/duct/reports/2024.06.10T21.44.08-3518040*': No such file or directory
(dev3) yoh@typhon:/mnt/DATA/data/yoh/BIDSonym$ ls -l total 148 drwxr-xr-x 1 yoh yoh 12 Jun 10 21:44 '~' -rw-r--r-- 1 yoh yoh 180 Jun 10 12:29 AUTHORS.rst ...
(dev3) yoh@typhon:/mnt/DATA/data/yoh/BIDSonym$ cat
which gduct
!/bin/bash
#
Helper to provide centralized collection of reports (when do not want per location)
#
set -eu
export DUCT_OUTPUT_PREFIX="~/.cache/duct/reports/{datetimefilesafe}-{pid}" mkdir -p "$(dirname "$DUCT_OUTPUT_PREFIX")"
duct "$@"
(dev3) yoh@typhon:/mnt/DATA/data/yoh/BIDSonym$ duct --version duct 0.0.1