Sponsored Content
Top Forums Shell Programming and Scripting First bash script for Raspberry pi Post 302996056 by melbarius on Tuesday 18th of April 2017 09:53:17 AM
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.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
XSET(1) 						      General Commands Manual							   XSET(1)

NAME
xset - user preference utility for X SYNOPSIS
xset [-display display] [-b] [b {on|off}] [b [volume [pitch [duration]]]] [-bc] [bc] [-c] [c {on|off}] [c [volume]] [+dpms] [-dpms] [dpms standby [ suspend [ off]]] [dpms force {standby|suspend|off|on}] [fp=pathlist] [-fp=pathlist] [+fp=pathlist] [fp-pathlist] [fp+pathlist] [fp default] [fp rehash] [-led [integer|named indicator]] [led [integer|named indicator]] [led {on|off}] [mouse [accel_mult[/accel_div] [threshold]]] [mouse default] [p pixel color] [-r [keycode]] [r [keycode]] [r {on|off}] [r rate delay [rate]] [s [length [period]]] [s {blank|noblank}] [s {expose|noexpose}] [s {on|off}] [s default] [s activate] [s reset] [q] DESCRIPTION
This program is used to set various user preference options of the display. OPTIONS
-display display This option specifies the server to use; see X(7). b The b option controls bell volume, pitch and duration. This option accepts up to three numerical parameters, a preceding dash(-), or a 'on/off' flag. If no parameters are given, or the 'on' flag is used, the system defaults will be used. If the dash or 'off' are given, the bell will be turned off. If only one numerical parameter is given, the bell volume will be set to that value, as a percentage of its maximum. Likewise, the second numerical parameter specifies the bell pitch, in hertz, and the third numerical parameter specifies the duration in milliseconds. Note that not all hardware can vary the bell characteristics. The X server will set the characteristics of the bell as closely as it can to the user's specifications. bc The bc option controls bug compatibility mode in the server, if possible; a preceding dash(-) disables the mode, otherwise the mode is enabled. Various pre-R4 clients pass illegal values in some protocol requests, and pre-R4 servers did not correctly generate errors in these cases. Such clients, when run against an R4 server, will terminate abnormally or otherwise fail to operate cor- rectly. Bug compatibility mode explicitly reintroduces certain bugs into the X server, so that many such clients can still be run. This mode should be used with care; new application development should be done with this mode disabled. The server must support the MIT-SUNDRY-NONSTANDARD protocol extension in order for this option to work. c The c option controls key click. This option can take an optional value, a preceding dash(-), or an 'on/off' flag. If no parame- ter or the 'on' flag is given, the system defaults will be used. If the dash or 'off' flag is used, keyclick will be disabled. If a value from 0 to 100 is given, it is used to indicate volume, as a percentage of the maximum. The X server will set the volume to the nearest value that the hardware can support. -dpms The -dpms option disables DPMS (Energy Star) features. +dpms The +dpms option enables DPMS (Energy Star) features. dpms flags... The dpms option allows the DPMS (Energy Star) parameters to be set. The option can take up to three numerical values, or the `force' flag followed by a DPMS state. The `force' flags forces the server to immediately switch to the DPMS state specified. The DPMS state can be one of `standby', `suspend', `off', or `on'. When numerical values are given, they set the inactivity period (in units of seconds) before the three modes are activated. The first value given is for the `standby' mode, the second is for the `suspend' mode, and the third is for the `off' mode. Setting these values implicitly enables the DPMS features. A value of zero disables a particular mode. fp= path,... The fp= sets the font path to the entries given in the path argument. The entries are interpreted by the server, not by the client. Typically they are directory names or font server names, but the interpretation is server-dependent. fp default The default argument causes the font path to be reset to the server's default. fp rehash The rehash argument resets the font path to its current value, causing the server to reread the font databases in the current font path. This is generally only used when adding new fonts to a font directory (after running mkfontdir to recreate the font data- base). -fp or fp- The -fp and fp- options remove elements from the current font path. They must be followed by a comma-separated list of entries. +fp or fp+ This +fp and fp+ options prepend and append elements to the current font path, respectively. They must be followed by a comma-sep- arated list of entries. led The led option controls the keyboard LEDs. This controls the turning on or off of one or all of the LEDs. It accepts an optional integer, a preceding dash(-) or an 'on/off' flag. If no parameter or the 'on' flag is given, all LEDs are turned on. If a preced- ing dash or the flag 'off' is given, all LEDs are turned off. If a value between 1 and 32 is given, that LED will be turned on or off depending on the existence of a preceding dash. ``xset led 3'' would turn led #3 on. ``xset -led 3'' would turn it off. The particular LED values may refer to different LEDs on different hardware. If the X server supports the XKEYBOARD (XKB) extension, leds may be referenced by the XKB indicator name by specifying the `named' keyword and the indicator name. For example, to turn on the Scroll Lock LED: xset led named "Scroll Lock" mouse The m option controls the mouse parameters; it may be abbreviated to 'm'. Of course, it applies to most pointing devices, not just mice. The parameters for the pointing device are `acceleration' and `threshold'. The acceleration can be specified as an integer, or as a simple fraction. Threshold is just an integer. The setting is applied to all connected pointing devices. xinput(1) should be used if you need device-specific settings. By default the pointer (the on-screen representation of the pointing device) will go `acceleration' times as fast when the device travels more than `threshold' mickeys (i.e. would-be pixels) in 10 ms, including a small transition range. This way, the pointing device can be used for precise alignment when it is moved slowly, yet it can be set to travel across the screen in a flick of the wrist when desired. One or both parameters for the m option can be omitted, but if only one is given, it will be interpreted as the acceleration. If no param- eters or the flag 'default' is used, the system defaults will be set. If the `threshold' parameter is provided and 0, the `acceleration' parameter will be used in the exponent of a more natural and continuous formula, giving precise control for slow motion but big reach for fast motion, and a progressive transition for motions in between. Recom- mended `acceleration' value in this case is 3/2 to 3, but not limited to that range. In the X.org X Server 1.6 and above, the behaviour described so far is linked to the default profile. There are other profiles (i.e. func- tions determining pointer acceleration from device velocity) and additional settings, so the above description may not apply to non-default cases. In the X.org Server 1.7, these are available as input device properties (see xinput). p The p option controls pixel color values. The parameters are the color map entry number in decimal, and a color specification. The root background colors may be changed on some servers by altering the entries for BlackPixel and WhitePixel. Although these are often 0 and 1, they need not be. Also, a server may choose to allocate those colors privately, in which case an error will be generated. The map entry must not be a read-only color, or an error will result. r The r option controls the autorepeat. Invoking with "-r", or "r off", will disable autorepeat, whereas "r", or "r on" will enable autorepeat. Following the "-r" or "r" option with an integer keycode between 0 and 255 will disable or enable autorepeat on that key respectively, but only if it makes sense for the particular keycode. Keycodes below 8 are not typically valid for this com- mand. Example: "xset -r 10" will disable autorepeat for the "1" key on the top row of an IBM PC keyboard. If the server supports the XFree86-Misc extension, or the XKB extension, then a parameter of 'rate' is accepted and should be fol- lowed by zero, one or two numeric values. The first specifies the delay before autorepeat starts and the second specifies the repeat rate. In the case that the server supports the XKB extension, the delay is the number of milliseconds before autorepeat starts, and the rate is the number of repeats per second. If the rate or delay is not given, it will be set to the default value. s The s option lets you set the screen saver parameters. This option accepts up to two numerical parameters, a 'blank/noblank' flag, an 'expose/noexpose' flag, an 'on/off' flag, an 'activate/reset' flag, or the 'default' flag. If no parameters or the 'default' flag is used, the system will be set to its default screen saver characteristics. The 'on/off' flags simply turn the screen saver functions on or off. The 'activate' flag forces activation of screen saver even if the screen saver had been turned off. The 'reset' flag forces deactivation of screen saver if it is active. The 'blank' flag sets the preference to blank the video (if the hardware can do so) rather than display a background pattern, while 'noblank' sets the preference to display a pattern rather than blank the video. The 'expose' flag sets the preference to allow window exposures (the server can freely discard window contents), while 'noexpose' sets the preference to disable screen saver unless the server can regenerate the screens without causing exposure events. The length and period parameters for the screen saver function determines how long the server must be inactive for screen saving to activate, and the period to change the background pattern to avoid burn in. The arguments are specified in seconds. If only one numerical parameter is given, it will be used for the length. q The q option gives you information on the current settings. These settings will be reset to default values when you log out. Note that not all X implementations are guaranteed to honor all of these options. SEE ALSO
X(7), Xserver(1), xmodmap(1), xrdb(1), xsetroot(1), xinput(1) AUTHOR
Bob Scheifler, MIT Laboratory for Computer Science David Krikorian, MIT Project Athena (X11 version) XFree86-Misc support added by David Dawes and Joe Moss Manpage updates added by Mike A. Harris <mharris@redhat.com> X Version 11 xset 1.2.2 XSET(1)
All times are GMT -4. The time now is 05:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy