Shell Scripting on Raspberry PI

Consider the leds (the little lights) on your raspberry pi. These lights can be changed by sending messages to the device about how to behave.

The first script you are to write (which you must decompose into smaller scripts/functions) is to allow a user of your script to manipulate the leds on your pi.

When the script starts up, it will scan the contents of /sys/class/leds to get a list of the leds on the system (each link in this directory points to a directory for the settings of that led).

The two files we are interested in are “brightness” and “trigger”.

The scripting tasks:

Each of these scripting tasks must be in a separate function. It should have a sensible name to streamline maintainability (task1, task2, etc will be marked down) and should follow standard conventions such as paths to executables specified in variables at the top of the script, functions should only reference local variables UNLESS they represent shared state in the program (hardly any of these should so you need to make a case as to why you have done this in your README if you have).

You are required to check for errors after each command you enter and capture any output text into a variable. You should then output error messages in a reasonable format such as “This operation has failed:” followed by the error message that was output by the command.

You are required to disable the control-c interupt of the script and the script should handle any requests to quit gracefully. You should opt in all cases for the calling of programs to do work for you rather than performing operations in your script. For the purpose of these tasks you must restrict yourself to standard UNIX utilities.

Note that all submitted scripts must use bash and must specify the interpreter at the top of the script.

Task 2: Script launch (8 marks)

On start of your script it should read the contents of the /sys/class/leds directory and present a menu for your program. An example run of your program should look like:

Welcome to Led_Konfigurator!


Please select an led to configure:

1. input0::capslock

2. input0::numlock

3. input0::scrolllock

4. input4::capslock

5. input4::numlock

6. input4::scrolllock

7. led0

8. led1

9. Quit

Please enter a number (1-9) for the led to configure or quit:

Please note that hardcoding this menu will get you 0 marks. It must be generated from the contents of the /sys/class/leds directory.

Task 3: LED Manipulation Menu (10 Marks)

Create a function that will display a menu of options for any led selected which shall look like the following:

[LED NAME] <-- replace this name with the actual name of the led.


What would you like to do with this led?

1) turn on

2) turn off

3) associate with a system event

4) associate with the performance of a process

5) stop association with a process’ performance

6) quit to main menu

Please enter a number (1-6) for your choice:

Task 4: Turn on and off the led (4 Marks)

The “turn on” command above echoes 1 into the brightness file for the respective led and the “turn off” command echoes 0 into the brightness file.

Task 5: Associate LED with a system event (10 Marks)

The associate with a system event menu will list the events from the trigger file with a * next to the currently selected event. So the menu for that option would look like (next page):

Please note that if the options on the menu scroll off the screen, you are required to page the menu with more. Please note that hard coding this menu will get you 0 marks. It must be dynamically generated from the contents of the trigger file.

Program Documentation,

All functions must be appropriately comments with a header comment for each function describing parameters and the expected outcome of the function. There must be a reasonable number of comments in your program so that it is clear what you intention is. Also, you must provide a readme file that explains how we can use your program

Ujuzi: Linux, Kuprogrammu, Python, Raspberry Pi, Software Architecture

Angalia zaidi: raspberry pi scripting language, raspberry pi bash, useful raspberry pi scripts, raspberry pi run shell script on startup, raspberry pi shell commands, how to write shell script in raspberry pi, raspberry pi make script executable, raspberry pi python scripts, example script selling service, remove single line file shell scripting, unix shell scripting institute hyderabad, php example script link page, linux example script delete owner files, shell scripting add lines file, freelancing shell scripting, need example script, zend framework example script, example script tour guiding, dash shell scripting, linux shell scripting freelancing

Kuhusu Muajiri:
( Maoni 6 ) Richmond, Australia

Kitambulisho cha Mradi: #17937771

Imetuzwa kwa:


I have done Bash menus, and will write the script with very high quality - functions, comments, local variables, etc.

$100 AUD kwa siku 1
(Maoni 257)

8 freelancers are bidding on average $175 for this job


Hi, SIR I have developed some Raspberry PI projects in these days. I am experts in embedding programming, Raspberry PI, and so on. I can do my best and I have testing devices. Hope to work for you. Thanks Gao

$200 AUD kwa siku 3
(Maoni 35)
shadabkhan92 done the similar jobs lets chat

$294 AUD kwa siku 3
(Maoni 39)

Dear Employer, How are you? As you can see in my profile, I have great experience in C/C++, C#, and Java programming as well as Microcontroller. Especially, I have completed many Raspberry Pi and Arduino projects and Zaidi

$155 AUD kwa siku 3
(Maoni 24)

Hello, Looks like an interesting project in shell script. You can refer my profile and if interested please contact me. I can share my previous works on shell scripts or you can find the reviews here. I need acce Zaidi

$100 AUD kwa siku 3
(Maoni 24)
$208 AUD kwa siku 7
(Maoni 1)

I have worked on scripts like this a bit when developing test/build systems for various projects. I may need a few days to get my hands on a PI but after that, I can deliver the code to you for in a day. This small tas Zaidi

$230 AUD kwa siku 10
(Maoni 0)

I've been a systems and software engineer for nearly a decade. I write shell scripts in many different scripting languages, in a large corporate environment, every day. Bash is currently one of my strongest and most en Zaidi

$111 AUD kwa siku 1
(Maoni 0)