soc.octade.net is a Fediverse instance that uses the ActivityPub protocol. In other words, users at this host can communicate with people that use software like Mastodon, Pleroma, Friendica, etc. all around the world.

This server runs the snac software and there is no automatic sign-up process.

Admin email
social@octade.net

Search results for tag #bash

[?]Jesus Michał von Gentoo 🏔 (he) » 🌐
@mgorny@social.treehouse.systems

Fun way to see the 256 terminal colors:

for x in {0..255}; do printf "\033[1;48;5;%dm%4d\033[0m\n" "${x}" "${x}"; done | column

    [?]R.L. Dane :Debian: :FreeBSD: :OpenBSD: :NetBSD:🍵 :MiraLovesYou: [he/him/my good fellow] » 🌐
    @rl_dane@polymaths.social

    #bash folks, I've got a conundrum.

    On some (but not all) of my machines, the date lines in my bash history get tacked onto the end of the commands in the history, but not always. What I mean is, if I run a command like "doas service netif restart" on this machine, then immediately close the terminal, then later on do a search (esc,/ for me, because I use set -o vi), I will get "doas service netif restart" and then several lines of commented date stamps at the end, like this:

    rld@Intrepid:~$ doas service netif restart
    #logindate=Sun Sep 20 08:38:14 CDT 2026
    #logindate=Sun Sep 20 08:41:01 CDT 2026
    #logindate=Sun Sep 20 08:41:31 CDT 2026
    

    Here are the pertinent (AFAIK) variables:

    rld@Intrepid:~$ grep '^[^#]*HIST[A-Za-z0-9_-]*=' .bash*
    .bash_profile:HISTCONTROL=ignoreboth
    .bashrc2:export HISTTIMEFORMAT="%F %T " #add a datestamp to the history
    .bashrc2:export HISTFILESIZE=-1		#do not truncate
    .bashrc2:export HISTSIZE=10000
    rld@Intrepid:~$ 
    

    Here's a bigger dump of env vars, if it helps:

    rld@Intrepid:~$ set |grep -E '^[A-Z0-9_-]+='
    ALIASES_FILE=/home/rld/.bash_aliases
    BASH=/usr/local/bin/bash
    BASHOPTS=checkjobs:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:globskipdots:globstar:histappend:interactive_comments:lastpipe:lithist:login_shell:patsub_replacement:progcomp:promptvars:sourcepath
    BASHRC2=true
    BASH_ALIASES=()
    BASH_ALIASES_FILE=true
    BASH_ARGC=([0]="0")
    BASH_ARGV=()
    BASH_CMDS=()
    BASH_COMPLETION_VERSINFO=([0]="2" [1]="17" [2]="0")
    BASH_FUNCTIONS_FILE=true
    BASH_LINENO=()
    BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.
    BASH_REMATCH=()
    BASH_SOURCE=()
    BASH_VERSINFO=([0]="5" [1]="3" [2]="15" [3]="0" [4]="release" [5]="amd64-portbld-freebsd15.0")
    BASH_VERSION='5.3.15(0)-release'
    BLOCKSIZE=K
    BROWSER=librewolf
    COLORTERM=true
    COLUMNS=111
    COMP_FILEDIR_FALLBACK=BASH_COMPLETION_FILEDIR_FALLBACK
    COMP_KNOWN_HOSTS_WITH_AVAHI=BASH_COMPLETION_KNOWN_HOSTS_WITH_AVAHI
    COMP_KNOWN_HOSTS_WITH_HOSTFILE=BASH_COMPLETION_KNOWN_HOSTS_WITH_HOSTFILE
    COMP_WORDBREAKS=$' \t\n"\'><=;|&(:'
    DIRSTACK=()
    DISPLAY=:0
    DMENU_OPTIONS=-i
    EDITOR=nvi
    EUID=1001
    FUNCTIONS_FILE=/home/rld/.bash_functions
    GDK_BACKEND=wayland
    GROUPS=()
    GTK_CSD=0
    GTK_OVERLAY_SCROLLING=0
    HISTCONTROL=ignoreboth
    HISTFILE=/home/rld/.bash_history
    HISTFILESIZE=-1
    HISTSIZE=10000
    HISTTIMEFORMAT='%F %T '
    HOME=/home/rld
    HOSTNAME=Intrepid
    HOSTTYPE=amd64
    I3SOCK=/var/run/xdg/rld/sway-ipc.1001.40558.sock
    IFS=$' \t\n'
    LANG=en_US.UTF-8
    LC_ALL=en_US.UTF-8
    LESS='-iXFR --wordwrap'
    LINES=26
    LOGNAME=rld
    MACHTYPE=amd64-portbld-freebsd15.0
    MAIL=/var/mail/rld
    MAILCHECK=60
    MANPATH=/home/rld/.local/man:/home/rld/.local/share/man:/usr/local/lib/perl5/site_perl/man:/usr/local/lib/perl5/5.42/perl/man:/usr/local/share/man:/usr/share/man:/usr/share/openssl/man:/home/rld/.local/pipx/venvs/yt-dlp/share/man
    MM_CHARSET=UTF-8
    MOZ_ENABLE_WAYLAND=1
    MOZ_WEBRENDER=1
    OLDPWD=/home/rld/working
    OPTERR=1
    OPTIND=1
    OSTYPE=freebsd15.0
    PAGER='less -iX'
    PATH='/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/home/rld/bin:~/.local/bin:/home/rld/go/bin:/home/rld/.local/bin'
    PIPESTATUS=([0]="0" [1]="0" [2]="0")
    PPID=63829
    PPNAME=foot
    PS1='\[\e]0;\u@\h: \W\a\]\[\033[1;38;5;22m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]$ '
    PS2='> '
    PS4='+ '
    PWD=/home/rld
    SHELL=/usr/local/bin/bash
    SHELLOPTS=braceexpand:hashall:histexpand:history:interactive-comments:monitor:vi
    SHELL_PPID=63829
    SHLVL=1
    SWAYSOCK=/var/run/xdg/rld/sway-ipc.1001.40558.sock
    TERM=foot
    TERMINFO=/usr/local/share/site-terminfo
    TEXTBROWSER=cha
    TMPDIR=/tmp/rld
    UID=1001
    USER=rld
    UXN_ROMS_DIR=/home/rld/Documents/uxn-roms
    VISUAL=nvi
    WAYLAND_DISPLAY=wayland-1
    XCURSOR_SIZE=29
    XCURSOR_THEME=Adwaita
    XDG_CURRENT_DESKTOP=sway
    XDG_DATA_DIRS=
    XDG_PICTURES_DIR=/home/rld/Pictures
    XDG_RUNTIME_DIR=/var/run/xdg/rld
    XDG_SCREENSHOTS_DIR=/home/rld/Pictures
    XDG_SESSION_TYPE=wayland
    _=.bashrc2
    _JAVA_AWT_WM_NONREPARENTING=1
    __ZFS_CMD=/sbin/zfs
    __ZPOOL_CMD=/sbin/zpool
    

    #unix #shell #UnixShell

      [?]R.L. Dane :Debian: :FreeBSD: :OpenBSD: :NetBSD:🍵 :MiraLovesYou: [he/him/my good fellow] » 🌐
      @rl_dane@polymaths.social

      New #blog #post: Gratitude Day 19: UNIX Shell

      https://rldane.space/gratitude-day-19-unix-shell.html

      1228 words? Maybe? I dunno.

      Umm, I didn't sleep well, so my apologies if this one is kind of confusing, rambly, and info-dumpy. 😁

      cc: my wonderful #chorus: @joel @dm @sotolf @thedoctor @pixx @orbitalmartian @adamsdesk @krafter @roguefoam @clayton @giantspacesquid @stfn @golemwire

      (I will happily add/remove you from the chorus upon request! :)

      #rlDaneWriting #blost #SeptemberTheme #SeptemberBloggingTheme #SepThemeBear #SeptemberGratitude #gratitude #thankfulness #unix #linux #bsd #shell #unixShell #POSIX #bash #Scripting

        [?]The whale » 🌐
        @thewhalecc@framapiaf.org

        𝗕𝗮𝘀𝗵 𝗴𝘂𝗶𝗱𝗲:

        thewhale.cc/posts/bash-guide

        A guide to learn bash: basic operations, basic shell programming, tricks and debugging.

        A guide to learn bash: basic operations, basic shell programming, tricks and debugging.

        Alt...A guide to learn bash: basic operations, basic shell programming, tricks and debugging.

          [?]Vassil Nikolov | Васил Николов » 🌐
          @vnikolov@ieji.de

          A quick and easy exercise in Unix shell programming with the Bourne-again shell (`bash’).

          What does the following do?

          function m () { sha256sum "${1:?"?"}" | (read s t && sha256sum * | grep "^${s}") }

          There is, of course, at least one more way to do that, perhaps less fancy.




            [?]hoergen » 🌐
            @hoergen@horche.demkontinuum.de

            Dateien FAT32 kompatibel umbenennen - Bash-Script

            hyperblog.de/hoergen/posts/202…

            Ein Bash-Skript, das FAT32-ungültige Zeichen in Dateinamen ersetzt, Steuerzeichen entfernt und Kollisionen vermeidet - z.B. für USB-Sticks, SD-Karten und externe Festplatten.

            Symbolbild - Computer mit usb Stick & SD Karte

            Alt...Symbolbild - Computer mit usb Stick & SD Karte

            Location: Efate

              [?]The whale » 🌐
              @thewhalecc@framapiaf.org

              𝗕𝗮𝘀𝗵 𝗴𝘂𝗶𝗱𝗲:

              thewhale.cc/posts/bash-guide

              A guide to learn bash: basic operations, basic shell programming, tricks and debugging.

              A guide to learn bash: basic operations, basic shell programming, tricks and debugging.

              Alt...A guide to learn bash: basic operations, basic shell programming, tricks and debugging.

                [?]🇨🇦Samuel Proulx🇨🇦 » 🌐
                @fastfinge@fed.interfree.ca

                This was invented for . However, I'm finding it really nice for screen readers:
                RTK rewrites output from chatty terminal commands that produce a lot of output, often in complex tables, in order to make the output 80 to 90 percent shorter. Just put rtk in front of the command you want to compress. So "rtk git status" instead of "git status". And you can be sure the compacted output is correct because it's just using regular expressions and deterministic rules under the hood to rewrite output from the tools it knows about. If it doesn't know about a particular command, it just passes the output on unchanged.
                github.com/rtk-ai/rtk
                Now I've got to figure out how to wire this up in
                so it'll just happen without me typing rtk all the time.

                  [?]AI6YR Ben » 🌐
                  @ai6yr@m.ai6yr.org

                  LOL, recursive script and sed = clobbered myself, ha ha. Who needs a malicious AI when you have a defective brain-to-fingers interface? 🤪

                    [?]The New Oil » 🤖 🌐
                    @thenewoil@mastodon.thenewoil.org

                    [?]nickbearded » 🌐
                    @nickbearded@mastodon.social

                    Thinking of introducing DuckDuckGo AI CLI into my minimalist bashcore CLI distros 🐧

                    ​I know, adding cloud AI to a sec-focused distro is controversial. But thanks to DDG's proxy, IP addresses are stripped for maximum privacy.

                    ​"That's one small step for a dev, one giant leap for CLI-kind"? 🌕🚀

                    ​What do my fellow linux friends think about this big step? Worth it?

                      [?]Vassil Nikolov | Васил Николов » 🌐
                      @vnikolov@ieji.de

                      Here is a "sketch of concept".
                      I am not satisfied with it, but it may be better than nothing.
                      (Relying on a DEBUG trap isn't really a good thing here, in my view.)

                      (1) Example transcript:

                      $ echo hello
                      hello
                      Ready(0); E=0.00 s 10:21:42
                      $ sleep 1.5
                      Ready(0); E=1.50 s 10:22:06
                      $
                      Ready(0); E=1.50 s 10:22:07
                      $ false | sleep 3.456
                      Ready(1 0); E=3.46 s 10:22:47
                      $
                      Ready(1 0); E=3.46 s 10:22:50
                      $ :
                      Ready(0); E=0.00 s 10:22:55
                      $
                      Ready(0); E=0.00 s 10:23:01

                      (2) Bash source for the above:

                      ### Print the elapsed time for the previous command before each bash prompt.
                      ### Uses a DEBUG trap and the PROMPT_COMMAND variable.

                      prompt__elapsed_time=""; state.

                      function prompt__print_prompt () {
                      declare -r s="${PIPESTATUS[*]}";
                      if [[ "${prompt__elapsed_time}" == "" ]]; then
                      ## The prompt does not change on just pressing Return (no command).
                      prompt__elapsed_time="$(printf '%s - %s\n' "${EPOCHREALTIME}" "${prompt__start_time}" | bc)";
                      fi;
                      ## Imitate IBM z/VM's CMS (partly: the latter prints user time and system time):
                      printf 'Ready(%s); E=%.2f s %s\n' "${s}" "${prompt__elapsed_time}" "$(date +%H:%M:%S)";
                      }

                      function prompt__set_time () {
                      if [[ "${BASH_COMMAND}" != "prompt__print_prompt" ]]; then
                      prompt__elapsed_time="";
                      prompt__start_time=${EPOCHREALTIME};
                      fi;
                      }

                      trap prompt__set_time DEBUG;
                      PROMPT_COMMAND=prompt__print_prompt;


                      @rl_dane @dougmerritt @AmenZwa @raven667

                        [?]R.L. Dane :Debian: :FreeBSD: :OpenBSD: :NetBSD:🍵 :MiraLovesYou: [he/him/my good fellow] » 🌐
                        @rl_dane@polymaths.social

                        I feel a madness slowly creeping into my mind, and it whispers to me,

                        "Write your own version of the #ed editor in #bash, just for giggles."

                        NOOOO!! I WILL NOT!!

                        THERE ARE FOUR LIGHTS!
                        THERE ARE FOUR LIGHTS!
                        THERE ARE FOUR LIGHTS!

                        :BlobCatBlankieScared:

                          [?]R.L. Dane :Debian: :FreeBSD: :OpenBSD: :NetBSD:🍵 :MiraLovesYou: [he/him/my good fellow] » 🌐
                          @rl_dane@polymaths.social

                          In the #shell #functions I should have written years ago category...

                          function fedilinktousername {
                              grep -oE 'https?://[^/]+/@[^/ ]+' |sed -E 's|https?://|@|; s|/@|@|; s/(@[^@]*)(@[^@]*)/\2\1/'
                          }
                          
                          function fediusernametolink {
                              grep -oE '(@[^@ ]+){2}' |sed -E 's|(@[^@ ]+)@([^@ ]+)|https://\2/\1|'
                          }
                          
                          rld@Intrepid:~$ clipo
                          https://polymaths.social/@rl_dane/statuses/01KVJCAG6Y4C1KTGBDBECH2778
                          rld@Intrepid:~$ clipo |fedilinktousername 
                          @rl_dane@polymaths.social
                          rld@Intrepid:~$ clipo |fedilinktousername |fediusernametolink 
                          https://polymaths.social/@rl_dane
                          rld@Intrepid:~$ 
                          

                          #UnixShell #ShellScripting #Unix #bash #ksh

                            [?]Dendrobatus Azureus » 🌐
                            @dendrobatus_azureus@polymaths.social

                            You and me both my internet friend; I've built quite a few interesting sites using pure HTML which have run for years with very little maintenance, due to their almost static nature

                            @rl_dane

                            #Firefox #CPU #usage #Dillo #HTML #pure #nostalgia #browser #light #sh #bash

                              [?]Dendrobatus Azureus » 🌐
                              @dendrobatus_azureus@polymaths.social

                              The mistake you maybe making is that you consider Firefox to be a browser.

                              Firefox has stopped being a browser decades ago

                              A browser doesn't need hundreds and hundreds of Engineers to be maintained, a massive project with multiple use angles and cases does

                              Firefox does so many (bad) things you can almost consider it a mini operating system

                              A alpha level Operating System, riddled with security bugs

                              It's always fantastic to be able to go somewhere in dillo and just have fun, amazing yourself with a speed that pages load

                              @rl_dane

                              #Firefox #CPU #usage #Dillo #browser #light #sh #bash

                                [?]R.L. Dane :Debian: :FreeBSD: :OpenBSD: :NetBSD:🍵 :MiraLovesYou: [he/him/my good fellow] » 🌐
                                @rl_dane@polymaths.social

                                Seriously, why didn't I put this in my ~/.bashrc like... YEARS ago? 😆

                                year=$( date +%Y)
                                month=$(date +%m)
                                day=$(  date +%d)
                                

                                #Unix #UnixShell #shell #ShellScripting #bash #bashrc

                                  OCTADE boosted

                                  [?]Brian Monroe » 🌐
                                  @paradoxguitarist@mastodon.online

                                  So I DO love me some python, but I just want to say that is awesome.

                                  I had no idea this was a thing:

                                  echo "${variable/$inTheString/$replacesIt}"