WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: busybox awk||ash && bytebeat||minimalist livecoding  (Read 946 times)

Offline solorin

  • Full Member
  • ***
  • Posts: 184
busybox awk||ash && bytebeat||minimalist livecoding
« on: October 16, 2012, 05:18:51 AM »
tl;dr only tangentially related to tc, just scroll down for links to some shell tutorials or
        skim some bs about digital audio.

ok, so recently i've been on this shell kick.
kicked off (i think) by this hipster: http://shellhaters.heroku.com/
i'd always thought i'd pick up bits and pieces of shell
automating some daily tasks, but i never thought to really get into it.
around 15:12 in this talk, the essence of shell hits me like ball lightening,
and I started to become fascinated.

when I first came to tc, a little google-fu about busybox
revealed ash was the default shell,
now, at the time I was reading all the intro stuff about linux
that google could drudge up (which included a great deal of stuff about bash)
but all i could find about ash was this manpage: http://linux.die.net/man/1/ash
which (although fairly comprehensive) doesn't really help one learn shell.
i shelved it for reference and my aspirations for becoming a shell ninja.

fast forward to recently.
deciding to research it methodically, i started where all accurate research begins
(and sometimes ends)  - the almighty oracle of this day and age-
http://en.wikipedia.org/wiki/Almquist_shell

<internaldialogue>
ah! so essentially ash is a posix-compatible Bourne shell clone,
if we learn Bourne shell with an eye towards the posix spec we should be ok.
why didn't we do this earlier?
:facepalm
 </internaldialogue>

in order of least involved to most involved, here are the free (if not libre) shell tutorials
i found most useful.

https://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/unixscripting/unixscripting.html
very basic. if you're clever or have heard about procedural programming you should be able to digest it with lunch.

http://www.ooblick.com/text/sh/
mo' better. the first half or so covers the same stuff as above.
but later it has exciting stuff about commonly-used utilities and scripting in style!

http://www.dartmouth.edu/~rc/classes/ksh/
on the tin it says it's about ksh and bash, but it's really good about telling you when it's talking about them. useful because you'll know what won't work in ash.
which you can also cross-reference with http://mywiki.wooledge.org/Bashism

http://shellhaters.heroku.com/posix which is really just a prettyfied toc for 
pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
the posix spec for the shell, and man pages for all the utilities you could ever want
(well the ones that are supposed to be on a posix compliant system anyway -
warning: busybox does not provide them all
http://www.busybox.net/downloads/BusyBox.html
tc is also not configured with everything in that list either; type busybox @ prompt in tc
to list what you have.)

https://en.wikibooks.org/wiki/Bourne_Shell_Scripting
ok, i haven't read this yet. but it looks like 100+ pages of shell tutorial deliciousness.

what'll really make things come together is reading some source code.
-----------------------------------
thanks Rich for reminding me that there is plenty of shell source right there in tc.
:facepalm again
-----------------------------------
also something from here maybe: https://github.com/languages/Shell/most_watched
well, except everybody and their pet iguana writes for bash these days.
your best bet is to find a project that at least tries to be posix-compatible and
make it run on tc.

which is one of the exercises i've been working on actually.
it's fun and enlightening, but that problem domain is
sometimes challenging or not so engaging.

well, at least not as ^endlessly fascinating^ as:

music.

which is what Part 2 is really about - all the finicky details of the problem domain.
(as far as my simplistic understanding goes).
and in which maybe we can hear the first warbles of a tiny but powerful bird.
and hopefully be generally more exciting.

cheerio.
« Last Edit: October 16, 2012, 04:56:35 PM by solorin »
. . . if you don't know, now you know. . .
        ----- R.I.P. Biggie Smalls -----

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4224
Re: busybox awk||ash && bytebeat||minimalist livecoding
« Reply #1 on: October 16, 2012, 06:43:50 AM »
Hi solorin
Two really good sources of what you can do with ash are:
Code: [Select]
/etc/init.d/tc-config
/etc/init.d/tc-functions
Though you will probably still need to reference some of the guides you listed to comprehend some of the syntax.

Offline solorin

  • Full Member
  • ***
  • Posts: 184
Re: busybox awk||ash && bytebeat||minimalist livecoding
« Reply #2 on: October 16, 2012, 04:32:03 PM »
thanks for sharing your knowledge so readily Rich.

correct me if i'm wrong but those would also be the "safest" to modify as well, yes?
« Last Edit: October 16, 2012, 09:10:19 PM by solorin »
. . . if you don't know, now you know. . .
        ----- R.I.P. Biggie Smalls -----

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4224
Re: busybox awk||ash && bytebeat||minimalist livecoding
« Reply #3 on: October 16, 2012, 04:57:02 PM »
Hi solorin
I would think twice before modifying those scripts, they may be subject to change in later versions of Tinycore.
The tc-functions script is used by other system scripts. You can call functions from it in your own scripts. If you
need additional commonly used functions, create an additional functions file. The tc-config file configures
Tinycore when it boots. If you need to change it, I would look into other ways of making changes before
altering that script.