home.social

#tcsh — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #tcsh, aggregated by home.social.

  1. So, after I met problems with iwlwifi driver and my attempts to aggregate both em0 and wlan0 interfaces to the one lagg0 interface (mastodon.bsd.cafe/@evgandr/115) — looks like I found a much (MUCH!) simpler solution :drgn_happy:

    I wanted to automatically switch between wired and wireless networks when I plug-in (or disconnect) my Ethernet cable. First, because I was a newbie in the FreeBSD world, I tried to search for some kind of NetworkManager. Thankfully, I didn't find any NetworkManager clone ported to the FreeBSD. I found some tries to port NetworkManager from Linux to FreeBSD but all of them are failed (not surprised, lol).

    Then, I finally started to read documentation :drgn_think_science: . In the section about advanced networking I read about aggregation interfaces. And somehow I managed to aggregate both of em0 and wlan0 to the one lagg0 interface and it works well.

    But, looks like (see mstdn.social/@erikarn/11598626) it is not the way how the lagg interfaces should work. It is not intended to use wireless interfaces in the aggregate interfaces — so my tricky setup stopped working in the FreeBSD 15.0.

    BUT, since we have a beautiful devd daemon, which listens for various system events and able to execute actions when event is happened — I just wrote 23 lines of shell script to learn my laptop how to switch between interfaces when the Ethernet cable (dis)connects, lol. Solution is very simple:

    First, we already have /etc/devd/dhclient.conf, which starts dhclient when some interface appeared in the system. I modified it, so it calls the sPeCiAL script, each time when em0, or wlan0, or ue0 interface appeared in the system, or when em0 is disappeared:

    notify 0 {
    match "system" "IFNET";
    match "type" "LINK_UP";
    media-type "ethernet";
    action "/root/bin/unfuck_network.tcsh $subsystem ifup";
    };

    notify 0 {
    match "system" "IFNET";
    match "type" "LINK_DOWN";
    media-type "ethernet";
    action "/root/bin/unfuck_network.tcsh $subsystem ifdown";
    };

    notify 0 {
    match "system" "IFNET";
    match "type" "LINK_UP";
    media-type "802.11";
    action "/root/bin/unfuck_network.tcsh $subsystem";
    };

    notify 0 {
    match "system" "ETHERNET";
    match "type" "IFATTACH";
    match "subsystem" "ue0";
    action "/root/bin/unfuck_network.tcsh ue0";
    };

    Then, the main magic happens in the /root/bin/unfuck_network.tcsh:
    — When Ethernet cable is connected — it destroys the wlan0 interface and starts dhclient for em0 to talk with DHCP server.
    — When Ethernet cable is disconnected — it makes all to remove route using em0 from routing table (removes em0 interface completely, flush routing table, etc — somehow em0 still stays in the routing table if interface is not destroyed; btw system will create it anyway later, in some point) and recreates the wlan0 interface.
    — When wlan0 device is created — it starts dhclient for it.

    Script contents (for tcsh):
    #!/bin/tcsh

    switch ( $1 )
    case "em0":
    if ( $2 == "ifup" ) then
    service netif quietstop wlan0
    service dhclient quietstart em0
    else if ( $2 == "ifdown" ) then
    service dhclient quietstop em0
    ifconfig em0 delete
    route flush
    service routing restart
    service netif quietstart wlan0
    endif
    breaksw;
    case "wlan0":
    service dhclient quietstart wlan0
    breaksw;
    case "ue0":
    service dhclient quietstart ue0
    breaksw;
    endsw

    #FreeBSD #FreeBSD150RELEASE #wifi #tcsh #devd #iwm

  2. Preparing an engineering-focused presentation entitled "The Zen of Shell Scripting" for an internal talk at work. Question for seasoned Shell programmers: What would you have liked to know when you first started out? Interested in both big ideas and sharp edges that come with Shell scripting.

    #shell #unix #linux #posix #bash #zsh #tcsh #ksh #fish

  3. If I've never seen the codebase, which shell has the easiest code to read and understand? Specifically I want to isolate the code for *parsing* the command line syntax.

    All -compliant (or close enough) shells welcome! I probably don't know them all but off the top of my head:



    (sorry for the spam, marine life enthusiasts)


    & I think?

  4. #Poll: Curious about people's attitudes towards shell scripting.

    Two part question:

    1. Are you a DEVeloper (or working in a development-heavy role), OTHER-IT worker (such as a sysadmin, architect, anything in a non-development-heavy role), or NON-IT (accountant, doctor, whatever)
    2. Do you HATE shell scripting, are you INDIFferent towards (or ignorant of) shell scripting, or do you LOVE it?

    #Unix #UnixShell #ShellScript #ShellScripting #POSIX #PosixShell #sh #bash #zsh #csh #tcsh #ksh #pdksh #oksh #mksh

  5. Linus Torvalds has proper motivated reasons for really disliking file systems without a case sensitivity.

    Read this with me from the kernel lkml, regarding bcachefs.

    Re: [GIT PULL] bcachefs fixes for 6.15-rc4 - Linus Torvalds
    lore.kernel.org/lkml/CAHk-=wja

    🖋️ #bash #sh #zsh #ksh #csh #tcsh #fish #git #Linux #lkml #POSIX #FOSS #100daysofCode #640DaysOfCode #coding #1024DaysOfCode #github #programming #Torvalds #filesystem

  6. This error in MX Linux KDE edition is now annoying

    I cant work without ffmpeg and Im NOT going to install a programming ENV: just to build one programma

    >>
    $ sudo apt install ffmpeg
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    Suggested packages:
    ffmpeg-doc
    The following NEW packages will be installed:
    ffmpeg
    0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
    Need to get 1,816 kB of archives.
    After this operation, 2,437 kB of additional disk space will be used.
    Get:1 deb.debian.org/debian bookworm/main amd64 ffmpeg amd64 7:5.1.6-0+deb12u1 [1,816 kB]
    Fetched 1,816 kB in 2s (992 kB/s)
    Selecting previously unselected package ffmpeg.
    (Reading database ... 342056 files and directories currently installed.)
    Preparing to unpack .../ffmpeg_7%3a5.1.6-0+deb12u1_amd64.deb ...
    Unpacking ffmpeg (7:5.1.6-0+deb12u1) ...
    Setting up ffmpeg (7:5.1.6-0+deb12u1) ...
    Processing triggers for man-db (2.11.2-2) ...
    metalloid@bugrupola:~
    $ ffmpeg
    ffmpeg: error while loading shared libraries: libavcodec.so.59: cannot open shared object file: No such file or directory

    <<

    Who knows a fix apart from compilation?

    #AskFediverse #ffmpeg #programming #Linux #KDE #MXLinux #iso #bash #tcsh #ksh #zsh #sh

  7. Tired of asking a web LLM to generate aws-cli commands for you and copy+pasting the result into your shell?

    I've written a shell command that does this for me, and I can't live without it now.

    getabc.sh/

    Ready for feedback and issues from early adopters.

    #cli #bash #zsh #tcsh #linux #mac #aws

  8. 🐚 TCSH, a shell for Fortune & Glory 🐚

    Relevant blog post @ OpenSource.com

    > "Why I still love tcsh after all these years. Bash may be more popular, but tcsh has advantages that make it more appealing..."

    - opensource.com/article/20/8/tc

    How about dot-files for my tcsh config, sure...
    - codeberg.org/winterschon/dot-f

    #freebsd #linux #sysadmin #engineering #terminal #shells #bash #tcsh #csh #modernSolutionsForModernProblems

  9. @kenshirriff @b0rk Always default to enclosing file names and other argument strings to your #shell in 'single quotes' unless you want it mucked about with substituting $ENVIRONMENT_VARIABLES or `command substitution` (which uses an entirely other kind of quote!)

    "Double quotes" will honor the spaces but also tell your shell to look for variable and command expansion.

    #Linux #Unix #bash #zsh #Zshell #ksh #csh #tcsh #fish #FishShell

  10. This guide shows you how to change your Linux shell, making the switch from(to) Bash, Fish, Zsh, or any other shell a breeze.
    linuxiac.com/how-to-change-she

    #linux #shell #bash #fishshell #zsh #tcsh

  11. @ojs @OpenBSDAms A C-Shell is a traditional default shell in #BSD systems (#FreeBSD uses the #tcsh implementation). So, finding at least a default configuration isn't too surprising.

  12. @flomaraninchi

    Oh, on est 2 à pas s'être décidés à migrer de #tcsh....?

    Bon après si je pouvais scripter le velouté ce serait en #bash. C'est que pour la cuisine interactive que j'ai pas le courage de recoder mes p'tits raccourcis qui vont bien pour sortir la poêle en fonte ou éditer le réglage du four en #vi.

  13. @vermaden @Anniiii @stefano To be fair, this article is *very* old and targets some "original" #csh, not #tcsh (which certainly fixes many of the severe bugs).

    Nevertheless, some strange behavior (like the inability to redirect stdout and stderr individually) persists.