• 0 Posts
  • 21 Comments
Joined 3 years ago
cake
Cake day: June 17th, 2023

help-circle






  • FarnsworthtoFedoraGRUB Freezing on Boot
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago

    I’m not using grub anymore, but from my time when I did, I remember there’s a “settings” file /etc/default/grub.

    Carefully change some timeout-related settings there (for example, add GRUB_TIMEOUT=5). Your change in the settings file becomes effective (on next boot) after you re-generate the grub “config” using the following command: grub2-mkconfig -o /boot/grub2/grub.cfg. Then check if it the problem still persists.

    Can you please post that file here? It should not contain any sensitive information.


  • FarnsworthtoLinux@lemmy.mlBash scripting question
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 months ago

    Start your analysis by doing only the “detection” part:

    find ./ -type f \( -iname \*.jpg -o -iname \*.png \)
    

    Now look carefully at the output (or dump it to a file first, by appending something like > /tmp/files.txt). Does it look good to you? Maybe it’s empty? See any spaces in filenames or directories?

    Here’s a sed stub that finds lines with whitespace:

    echo -e "line with space\nline_without_space" | sed -E -n '/\s/p'
    

    Get rid of the echo "'$dir'/'$base'", thats’s too much to read. Instead, add sanity checks in your loop, like this:

    [[ -f $file ]] || echo "file doesn't even exist: $file"
    

    or this:

    [[ -f "$dir/$base" ]] || echo "dirbase doesn't even exist: $dir/$base"
    

    There may be other issues, but to handle whitespace in file names correctly, you need more quoting at least here:

    dir="$(dirname "$file")"
    base="$(basename "$file")"
    


  • Very useful for renaming a variable: * to search “word” under cursor. Try this with hlsearch on::set hlsearch. Then cw to change a match. Alternate n and . to quickly rename more occurrences of the word. Do a :noh to get rid of the highlighting. Maybe try :set noinc, some people prefer the traditional “non-incremental” search.

    Do all this in normal mode. Vim experts leave insert mode as soon as possible. Almost forgot: Pressing C-c takes you back to normal mode without leaving home row.

    Most important advice: Never touch arrow keys. Keep your fingers on the home row. Learn hjkl movement (focus on j and k, they are more important). Then get faster by using b, w, f, o, O, A, I, C-d and all the rest. Learn about J, it’s cool. You won’t get far without u and C-r though.

    Critically important advice for fellow Europeans: If you care about vim, consider learning the US keyboard layout. Default bindings are not convenient in other layouts like qwertz (where is forward slash on qwertz? Hello?), and learning US layout might be easier than learning to customize vim. On a typical modern Linux system, there are US layout variants that still allow typing Umlauts, like EurKey or “DE-US”, where you type ä by pressing RightAlt+a, for example.