Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Banana Pro Blueprints

You're reading from   Banana Pro Blueprints Leverage the capability of Banana Pi with exciting real-world projects

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher Packt
ISBN-13 9781783552382
Length 366 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Ruediger Follmann Ruediger Follmann
Author Profile Icon Ruediger Follmann
Ruediger Follmann
Tony Zhang Tony Zhang
Author Profile Icon Tony Zhang
Tony Zhang
Arrow right icon
View More author details
Toc

Shell programming

A Linux shell is a command line interpreter that provides a user interface for a system itself. It can be used to install programs (apt-get install) or even for some programming, including conditions, logic, or loops. Linux provides many different shells. Very often, the Bourne shell is used, which was developed in the 70s by Stephen R. Bourne. This shell provides input and output redirection, pipes, background processes, and much more. For all Linux systems, a Bourne-compatible shell in the /bin/sh directory is available.

Checking the Banana Pro temperature

Let's start our first shell program using these steps:

  1. Edit a file called temperature and place the following content in it:
    #!/bin/sh
    cat /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input
    
  2. Save the file afterwards and make it executable:
    chmod 775 temperature
    
  3. Execute this file by typing this:
    ./temperature
    

My output shows 36200, which is the Banana Pro temperature multiplied by 1,000. The first line of the...

You have been reading a chapter from
Banana Pro Blueprints
Published in: Dec 2015
Publisher: Packt
ISBN-13: 9781783552382
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image