• Pup Biru@aussie.zone
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 month ago

      and then rinse and repeat for every level because you just don’t trust that mischievous cd

    • NostraDavid@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      1 month ago

      The first two options (autocd and cdspell) have been a lifesaver in fixing my frustrations with the default bash settings (and even lets me stick with bash, instead of feeling I should move to zsh or any other shell.

      I can just type a foldername, tabcomplete it and press enter to go there. It’s great.

      # == shopts ==
      # https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
      shopt -s autocd         # cd into folder without cd, so 'dotfiles' will cd into the folder
      shopt -s cdspell        # attempt spelling correcting on folders
      shopt -s direxpand      # expand a partial dir name
      shopt -s checkjobs      # stop shell from exit when there's jobs running
      shopt -s dirspell       # attempt spelling correcting on folders
      shopt -s expand_aliases # aliases are expanded
      shopt -s histappend     # append to the history file, don't overwrite it
      shopt -s histreedit     # lets your re-edit old executed command
      shopt -s histverify     # I'm confused.
      shopt -s hostcomplete   # performs completion when a word contains an '@'
      shopt -s cmdhist        # save multiple-line command in single history entry
      shopt -u lithist        # multi-lines are saved with embedded newlines rather than semicolons; explictly unset
      shopt -s checkwinsize # update LINES and COLUMNS to fit output
      
    • Bonsoir@lemmy.ca
      link
      fedilink
      arrow-up
      21
      arrow-down
      1
      ·
      1 month ago

      I do that too!
      I also alias ... to cd ../... I’ll be honest, I often forget to do it, but in theory it can speed things up.

  • over_clox@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    1 month ago

    Honestly I haven’t tried this on Linux yet, but didn’t Windows implement this somewhere along the way?..

    cd ....

      • over_clox@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        1 month ago

        Interesting, I might have to check that out someday.

        Though when I write scripts, I’m not a fan of blind folder navigation like that, there’s a good reason for the pushd and popd script commands.

        • Ephera@lemmy.ml
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 month ago

          Oh yeah, I wouldn’t use that for scripts. I wouldn’t use zsh for scripts either.
          I mean, I believe, it’s generally compatible with bash, but just throwing a shebang like #!/bin/sh or #!/bin/bash into the first line of the script will make it execute with sh or bash, even when you run it from zsh.

    • vortic@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      edit-2
      1 month ago

      I aliased cd to a custom funtion in my bashrc to do this at one point, but cd ../../../.. is too engrained so I never rembered to use it.