#TIL In bash you can create multiple (nested) directories with a single compact line:
-
@cark modifiziert -p is idempotent, too!
Like in any Script:tempdir_for_script=“/tmp/tempdir_for_$(basename “$0”)
Later in the script:
<result to log> >> “$tempdir_for_script”Last line of script:
# rm -r “$tempdir_for_script”(Remove # after full debugging)
-
@cark tested on OpenIndiana. Works in the same way. Thx!
-
@cark tested on OpenIndiana. Works in the same way. Thx!
@cark and also with fish on cachyos linux.
-
@cark Man, curly braces in bash creep me out. I can never remember whether that you need a comma to separate items (because glob expansion produces spaces). If I tried to build that command I would get errors or subfolders called ;

-
@cark Shell expansion magic
-
@cark This is a very neat trick of the sort where you learn about it and then spend five minutes thinking of a scenario where it would be useful.

-
@cark Whaaaat?! 🤯
-
R relay@relay.infosec.exchange shared this topic
-
@cark Brilliant, thanks for sharing!
-
@cark I love brace expressions to create backup copies or rename files. E.g. cp a{,.bak} or me b{,.old}
-
@cark I love brace expressions to create backup copies or rename files. E.g. cp a{,.bak} or me b{,.old}
I was not aware of this technique until recently... and yes I see also there are more use cases e.g. with `cp` and `mv`.

-
R relay@relay.infosec.exchange shared this topic