• Sonotsugipaa@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      11
      ·
      7 hours ago

      They’re annoying to deal with when interactively using command-line shells, especially so when pasting unquoted and unescaped file paths, doubly especially so with Bash where parameter expansion makes no goddamn sense if you know at least one other programming language

      • ronigami@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        6 hours ago

        Example of how parameter expansion matters?

        Generally if you are pasting file paths there is a better way to do that. Use find with exec, or xargs, or a for loop. Or, get the list in Vim and escape (quote) every line at once. Unless you have double quotes in the filename too (which is actually a crazy thing) it shouldn’t be a big deal.

        • Sonotsugipaa@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          1
          ·
          6 hours ago

          Expansion matters because using parameters without quotes automatically splits words, and IIRC a quoted array parameter can still be split into its members — as opposed to Zsh, where word splitting doesn’t happen unprompted and quoted array parameters are flattened into a single string.

          Generally if I want to run $HOME/random executable with spaces.exe through Wine in a terminal I copy the path in Dolphin (CTRL+SHIFT+C, or CTRL+ALT+C idr) and paste it, within quotes if needed (the four extra key inputs are the annoying part).

          I find that much faster than manually typing find "$HOME" -name "random executable with spaces.exe" -type x -exec wine "{}" \;, or opening an editor to insert backslashes.

          • ronigami@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            2 hours ago

            Why on earth not just type wine ~/random and then hit tab to autocomplete? Or you could do

            wine `echo random*`
            

            AFAIK, if $file is a filename with spaces, then some_util ${file} will not split the filename.