• I just discovered busybox, for Windows..

    From Aug@2:460/256 to All on Fri Sep 13 04:08:27 2024
    Hi All...

    I just discovered busybox, for Windows..

    busybox
    BusyBox v1.37.0-FRP-5398-g89ae34445 (2024-06-25 08:38:11 BST)
    (mingw32-gcc 14.1.1-3.fc40; mingw32-crt 11.0.1-3.fc40; glob)

    It's just one approx 600kb program that contains a selection of unix-like commands.

    The commands/functions available are:

    Currently defined functions:
    [, [[, ar, arch, ascii, ash, awk, base32, base64, basename, bash, bc, bunzip2, busybox,
    bzcat, bzip2, cal, cat, cdrop, chattr, chmod, cksum, clear, cmp, comm, cp, cpio, crc32,
    cut, date, dc, dd, df, diff, dirname, dos2unix, dpkg, dpkg-deb, drop, du, echo, ed, egrep,
    env, expand, expr, factor, false, fgrep, find, fold, free, fsync, ftpget, ftpput, getopt,
    grep, groups, gunzip, gzip, hd, head, hexdump, httpd, iconv, id, inotifyd, install, ipcalc,
    jn, kill, killall, lash, less, link, ln, logname, ls, lsattr, lzcat, lzma, lzop, lzopcat,
    make, man, md5sum, mkdir, mktemp, mv, nc, nl, nproc, od, paste, patch, pdpmake, pdrop,
    pgrep, pidof, pipe_progress, pkill, printenv, printf, ps, pwd, readlink, realpath, reset,
    rev, rm, rmdir, rpm, rpm2cpio, sed, seq, sh, sha1sum, sha256sum, sha3sum, sha512sum, shred,
    shuf, sleep, sort, split, ssl_client, stat, strings, su, sum, sync, tac, tail, tar, tee,
    test, time, timeout, touch, tr, true, truncate, ts, tsort, ttysize, uname, uncompress,
    unexpand, uniq, unix2dos, unlink, unlzma, unlzop, unxz, unzip, uptime, usleep, uudecode,
    uuencode, vi, watch, wc, wget, which, whoami, whois, xargs, xxd, xz, xzcat, yes, zcat

    QUESTION.. What are the [ and [[ functions as per the first line above?

    --
    /|ug
    https://t.me/aabolins

    --- Want fido for iOS/MacOS/Android/Win/Linux? https://shrtco.de/tpJ9yV
    * Origin: Fido by Telegram BBS from Stas Mishchenkov (2:460/256)
  • From Maurice Kinal@2:280/464.113 to Aug on Fri Sep 13 03:03:01 2024
    Hej Aug!

    What are the [ and [[

    Along with ] and ]] they are tests and exit returning a 0 for true and 1 for false.

    Try this at your busybox commandline;
    [ "a" = "a" ] ; echo $?

    It should return a 0 for true since a is equal to a. Now try;
    [ "a" = "b" ] ; echo $?

    In this case it should return a 1 for false since a is not equal to b.

    Clear as mud?

    Het leven is goed,
    Maurice

    o- -o -o o- -o -o o- o- o- o- o- -o -o -o -o -o /) (\ (\ /) (\ (\ /) /) /) /) /) (\ (\ (\ (\ (\ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ... Lieve zestien pinguïns van de Apocalyps.
    --- GNU bash, version 5.2.32(1)-release (x86_64-pc-linux-gnu)
    * Origin: Little Mikey's EuroPoint @ (2:280/464.113)
  • From August Abolins@2:221/1.58 to Maurice Kinal on Fri Sep 13 18:20:00 2024
    Hello Maurice!

    ** On Friday 13.09.24 - 03:03, Maurice Kinal wrote to Aug:

    Try this at your busybox commandline;
    [ "a" = "a" ] ; echo $?

    It should return a 0 for true since a is equal to a. Now try;
    [ "a" = "b" ] ; echo $?

    In this case it should return a 1 for false since a is not equal to b.


    busybox [ "a" = "a" ] ; echo $?
    [: missing ]

    Even in a shell, doesn't work:

    busybox sh
    H:/ $ H:\>[ "a" = "a" ] ; echo $?
    sh: H:>[: not found
    127
    H:/ $


    ..but the bash chell seemed to cooperate:

    busybox bash
    H:/ $ [ "a" = "a" ] ; echo $?
    0
    H:/ $

    H:/ $ [ "a" = "b" ] ; echo $?
    1
    H:/ $

    Thx.

    How does the double [, or [[ work?




    --
    ../|ug

    --- OpenXP 5.0.58
    * Origin: (2:221/1.58)
  • From Maurice Kinal@2:280/464.113 to August Abolins on Sat Sep 14 01:24:37 2024
    Hej August!

    busybox bash

    Given the version of busybox, that is either an aliased ash or hush shell. My guess is ash but the busybox config should tell the tale.

    How does the double [, or [[ work?

    They are currently the same although it seems to me at some time in the past there was a difference not unlike single quotes and double (strong) quotes.

    echo '$PATH'
    $PATH

    echo "$PATH"
    /usr/bin:/bin

    Apparently google bash scripts default to [[ for all their tests. I just don't recall the reason but I am obviously getting too old for this business. :::sigh:::

    Het leven is goed,
    Maurice

    o- o- -o o- -o -o -o o- -o -o o- o- -o o- -o o- /) /) (\ /) (\ (\ (\ /) (\ (\ /) /) (\ /) (\ /) ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ... Lieve zestien pinguïns van de Apocalyps.
    --- GNU bash, version 5.2.32(1)-release (x86_64-pc-linux-gnu)
    * Origin: Little Mikey's EuroPoint @ (2:280/464.113)
  • From August Abolins@2:221/1.58 to Maurice Kinal on Fri Sep 13 22:48:00 2024
    Hello Maurice!

    Given the version of busybox, that is either an aliased ash or hush
    shell. My guess is ash but the busybox config should tell the tale.

    A closer inspection reveals that busybox includes several shell
    choices:

    ash
    bash
    lash
    sh

    echo $SHELL in all of them reports /bin/sh


    Apparently google bash scripts default to [[ for all their tests. I just don't recall the reason but I am obviously getting too old for this business. :::sigh:::

    I was relying on separate GNUWin32 programs before. At one time
    I needed a decent split command. I eventually found it in the
    GNUWin32 collection, but the maximum split it supported was
    2GB. Busybox split doesn't seem to have that limitation.

    --
    ../|ug

    --- OpenXP 5.0.58
    * Origin: (2:221/1.58)
  • From Maurice Kinal@2:280/464.113 to August Abolins on Sun Sep 15 01:40:13 2024
    Hej August!

    I was relying on separate GNUWin32 programs before.

    In linux those are all seperate supplied by coreutils, util-linux and other such packages. I prefer them being seperate.

    but the maximum split it supported was 2GB. Busybox split
    doesn't seem to have that limitation.

    No suprise here. Near as I can tell coreutils' split is only limited by free disk size and free memory.

    Het leven is goed,
    Maurice

    o- o- o- -o -o o- o- -o o- o- -o -o -o -o o- -o /) /) /) (\ (\ /) /) (\ /) /) (\ (\ (\ (\ /) (\ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ... Lieve zestien pinguïns van de Apocalyps.
    --- GNU bash, version 5.2.32(1)-release (x86_64-pc-linux-gnu)
    * Origin: Little Mikey's EuroPoint @ (2:280/464.113)