Linux & Bash 102 material

114 views
Skip to first unread message

Boon Leong Ong

unread,
Nov 7, 2014, 10:01:13 AM11/7/14
to embedded-linu...@googlegroups.com
Dear all, 
           This is the latest pdf for the materials that we covered this evening. 
           For coming session, we will start at 7:30pm so that it will be friendlier for all. 
           I hope that all of you can try this out and familiar with the bash programming script. 

BL
We learn and grow together 
03-Linux-Basic-102.pdf

Chester Chin

unread,
Nov 19, 2014, 9:08:59 AM11/19/14
to embedded-linu...@googlegroups.com
HI BL,

Will make announcement today for the coming class on 21st. ^^

Boon Leong Ong

unread,
Nov 20, 2014, 10:59:39 AM11/20/14
to embedded-linu...@googlegroups.com
Hi Chester, 
        I was not checking the email. Ok. Let's do Friday 21-Nov-2014 7:30pm - 9:30pm.
        See you guys.Hope it is not too late...   
        Perhaps, we want to use what'sapp to connect everyone for announcement in future.

Boon Leong

Boon Leong Ong

unread,
Nov 22, 2014, 9:51:35 AM11/22/14
to embedded-linu...@googlegroups.com
Dear all,
           This is just an example of how to implement the lab work that we do on Friday.
           Since you all ask for it, I decided to upload the script into my github public repo.
  
           Feel free to refer and even make better. 
           As mentioned, I encourage discussion so that we cross-learn and I don't believe this is the best implementation.
           It is just one of the way to do that.

           Happy bashing.... :-)  

Chester Chin

unread,
Dec 19, 2014, 7:40:38 AM12/19/14
to embedded-linu...@googlegroups.com
HI All,

Link for my team source code.
http://1drv.ms/1wKq5Eu

The command line looks like this:

./poll_exer.sh -f polltxt -p 5 -d timer -d eth -d ahci

Credit goes to Teoh for the amazing codes. ^^

Boon Leong Ong

unread,
Dec 21, 2014, 8:36:14 PM12/21/14
to embedded-linu...@googlegroups.com
Good job.

There is still room for further enhancement. 
Also, we are asking for -d=usb,eth,ahci ? 
Another part is we should not assume it is always 3 devices too. Can be less or more ... 

Giap Hin Teoh

unread,
Dec 23, 2014, 10:03:25 PM12/23/14
to embedded-linu...@googlegroups.com
Dear Team,
    What Chester and I were trying to do was this:
-p <n polls> -d <dev1> -d <dev2> ... -d <dev m>
so that we will have a two-dimensional array for dev_int[m,n] (or dev_int[m][n] in C).  This part is ok.

    The problem is at the parsing to the HERE document where sed is used.  I can't get dev_int[m,n] assigned to DEVINT.  From the forum, it is said that awk is the way to go if you want to do array stuffs in string manipulation.  I am now looking at awk.

    If anyone knows how to do awk, please post your fix.

    Thank you.

regards,
hin

Giap Hin Teoh

unread,
Mar 5, 2015, 3:51:58 AM3/5/15
to embedded-linu...@googlegroups.com
Dear enthusiasts,
    Still not forgetting about our bash material.  This is the script which allows you to poll as many resources as you wish for as many times as you wish.  The usage is as follow:

$ ./poll_exer.sh -p 6 -d timer -d wifi -d eth -d usb -f mypolls

This command polls timer, wifi, ethernet and usb for six times.

    Most of the handling is performed in awk, especially array of poll results.  Because I can't figure out how to handle array with sed.  The debug output is shown on screen, the desired output is directed to file -f.

regards,
hin

poll_exer.sh
Reply all
Reply to author
Forward
0 new messages