First bash script for Raspberry pi


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting First bash script for Raspberry pi
# 1  
Old 04-18-2017
Linux First bash script for Raspberry pi

Hi,

I'm trying to get the configuration just as I'd like. But I can't get it to work?
I try to read if: xset s off xset -dpms xset s noblank
Is already in the .xinitrc file.... but it doesn't seem to work. I need it to check if it is already in the file otherwise it should echo that it's already in.


Code:
#!/bin/bash
if [[ read = "xset s off xset -dpms xset s noblank" /home/pi/.xinitrc ]]; then
    echo "xset is already configured";
else 
    echo >> /home/pi/.xinitrc "xset s off xset -dpms xset s noblank";
fi
echo >> /home/pi/.bashrc "export DISPLAY=:0
chromium-browser --kiosk https://google.com";


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 04-18-2017 at 11:22 AM.. Reason: Added CODE tags.
# 2  
Old 04-18-2017
Not sure I understand your logics. Please be aware that read is a bash builtin (command) and should not be used as a variable nor compared to anything like you do in above. You can use its exit code, though.
Did you consider the grep command?
# 3  
Old 04-18-2017
I'd like it to read what is in the .xinitrc file. If there is nothing then
Code:
echo xset s off xset -dpms xset s noblank >> into .xinitrc
else echo "do nothing"

Is it possible that it checks the file for containing the
Code:
xset s off xset -dpms xset s noblank

information in it?

Last edited by melbarius; 04-18-2017 at 01:03 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

2. Emergency UNIX and Linux Support

Are these Raspberry Pi kits really complete?

This is a test to see if the Emergency and UNIX and Linux Support forum is still working... I see that Amazon has a deal on Raspberry Pis today (CanaKit Raspberry Pi 3 B+ (B Plus) Starter Kit (32 GB EVO+ Edition, Premium Black Case) and CanaKit Raspberry Pi 3 Complete Starter Kit - 32 GB... (4 Replies)
Discussion started by: Don Cragun
4 Replies

3. UNIX for Beginners Questions & Answers

Project with Raspberry Pi

i have been given a raspberry Pi with some applications i am told run in Unix. I do not know much (close to nothing about Unix) that's why I'm here. I need someone to remote view (team viewer) into my machine and try and show me how to get this application running. If there is success there... (1 Reply)
Discussion started by: supaflygy
1 Replies

4. News, Links, Events and Announcements

An interesting Raspberry Pi add-on...

Hi all... An interesting idea for Raspberry Pi... Raspberry Pi goes Hi-Fi with audio valve amp | Electronics Weekly Enjoy... (1 Reply)
Discussion started by: wisecracker
1 Replies

5. News, Links, Events and Announcements

Raspberry PI Zero, Free with MagPI magazine.

Not sure if this is the right forum... But a mini Raspberry PI, Raspberry PI Zero, free with MagPI magazine... Shrinking to Zero: The Raspberry Pi gets smaller - BBC News Fantastic for a simple Raspbian Debian based project... (0 Replies)
Discussion started by: wisecracker
0 Replies

6. Debian

How to play avi files Raspberry Pi?

Raspberry Pi B 2014-01-07 Raspbian fully up to date. Installed and configured motion for surveillance. It works just fine and creates .avi files and .jpeg. Installed Mplayer trying to run it from desktop was not successful. I did try to do a command line by executing sudo mplayer... (6 Replies)
Discussion started by: oldcity
6 Replies

7. AIX

3151 Emulation on Raspberry pi

Anybody done it? We use a legacy application that requires 3151 emulation. I am experimenting with a raspberry Pi running Debian. Wondering if nothing else, somebody might know where I can get some source code for a basic emulator? (1 Reply)
Discussion started by: jeveretts
1 Replies

8. What is on Your Mind?

Raspberry PI

The small red box to the left of TV is the Raspberry PI. Successfully installed and running Raspbian Wheezy. I learnt about Raspberry PI from Neo here on unix.com. Thanks to you Neo :b: (6 Replies)
Discussion started by: balajesuri
6 Replies

9. What is on Your Mind?

Raspberry Pi anyone?

Anyone order or get the new Rasberry Pi? I'm still waiting. Even though it's a fun project, I think these will turn out to be toys for people who already have PC's, and a boon to those who do not. But that is not stopping me. If my wallet holds out, maybe I can build a Raspberry Pi beowulf... (1 Reply)
Discussion started by: jim mcnamara
1 Replies

10. What is on Your Mind?

Possible Arcade Cabinet Application of the Raspberry Pi

Hi guys, My name is Ryan. I'm from Providence, Rhode Island. A friend and I are working on a homemade video game cabinet design in the style of classic arcade games from the late seventies to nineties. We're designing a system that allows people to play these original games on their original... (0 Replies)
Discussion started by: kabungalee
0 Replies
Login or Register to Ask a Question