Popular Bash recipes tagged "linux"http://code.activestate.com/recipes/langs/bash/tags/linux/2017-05-13T12:12:30-07:00ActiveState Code RecipesA white noise generator to sooth baby to sleep. (Bash) 2017-05-13T12:12:30-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/580801-a-white-noise-generator-to-sooth-baby-to-sleep/ <p style="color: grey"> Bash recipe 580801 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/alarm/">alarm</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/baby_alarm/">baby_alarm</a>, <a href="/recipes/tags/cygwin/">cygwin</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/noise/">noise</a>, <a href="/recipes/tags/sleep/">sleep</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/whitenoise/">whitenoise</a>). </p> <p>This is a simple BASH, DASH and SH script to sooth a newborn baby to sleep for a laptop with a builtin mic. Develeoped around an Apple MacBook Pro.</p> <p>Usage:- [./]shush.sh &lt;time in seconds from 18 to 2700&gt; [sensitivity [Hh|Mm|Ll]]&lt;CR&gt;</p> <p>If time is omitted it defaults to 2 bursts of 9 seconds each and if sensitivity is omitted defaults to [M]edium.</p> <p>It uses Quicktime Player for Apple OSX 10.12.4 minimum /dev/dsp for CygWin and some Linux flavours and arecored for Linux ALSA machines for baby awake detector.</p> <p>Upon the two arguments the white noise generator runs for approximately the time given in $1 in bursts of 9 seconds until the time limit is reached. $2 is used to detect of baby is awake and reruns the noise generator again with a new noise waveform.</p> <p>Enjoy...</p> A script to automate installing MTS Mblaze UI in linux (Bash) 2015-07-29T18:26:59-07:00Emil george jameshttp://code.activestate.com/recipes/users/4191910/http://code.activestate.com/recipes/579039-a-script-to-automate-installing-mts-mblaze-ui-in-l/ <p style="color: grey"> Bash recipe 579039 by <a href="/recipes/users/4191910/">Emil george james</a> (<a href="/recipes/tags/internet/">internet</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/web/">web</a>). </p> <p>An automate shell linux script to install mts mblaze ui application in all linux distros.this shell script automatically install the mts mblaze ui in your linux systems .installation script will setup everything need to choose some option interactively from setup.Script can work for all linux environments.</p> Print selected text pages to PDF with Python, selpg and xtopdf on Linux (Bash) 2014-10-29T17:38:10-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578954-print-selected-text-pages-to-pdf-with-python-selpg/ <p style="color: grey"> Bash recipe 578954 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/text/">text</a>, <a href="/recipes/tags/text_files/">text_files</a>, <a href="/recipes/tags/text_processing/">text_processing</a>, <a href="/recipes/tags/unix/">unix</a>). </p> <p>This recipe shows how to use selpg, a Linux command-line utility written in C, together with xtopdf, a Python toolkit for PDF creation, to print only a selected range of pages from a text file, to a PDF file, for display or print purposes. The way to do this is to run the selpg utility at the Linux command line, with options specifying the start and end pages of the range, and pipe its output to the StdinToPDF.py program, which is a part of the xtopdf toolkit.</p> Simple Bash Text Mode Sine Curve Generator. (Bash) 2014-08-12T20:57:39-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578921-simple-bash-text-mode-sine-curve-generator/ <p style="color: grey"> Bash recipe 578921 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/cygwin/">cygwin</a>, <a href="/recipes/tags/graph/">graph</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/text/">text</a>). Revision 2. </p> <p>This bash script is a taster for a kids level, audio, text mode, sweep generator. The code just creates a single cycle of a quantised sine curve inside an 80 x 24 bash terminal. This will be the calculator for a sinewave sweep generator from about 50Hz the 12KHz... The code tells you more and the display is in comments at the end...</p> A Bash Beep Command For OSX 10.7+... (Bash) 2014-02-27T19:36:17-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578837-a-bash-beep-command-for-osx-107/ <p style="color: grey"> Bash recipe 578837 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/beep/">beep</a>, <a href="/recipes/tags/error_beep/">error_beep</a>, <a href="/recipes/tags/error_sound/">error_sound</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/sound/">sound</a>). </p> <p>This small bash script generates an 8044 byte 1KHz sinewave wave file and immediately plays it. The file created is a _pure_ sinewave and lasts for 1 second. It uses the default "afplay" command to run the generated file.</p> <p>It was designed around an Apple Macbook Pro but using "aplay" it might even work on other *nix flavours from the command line. I have not bothered to try it as this was purely for my MB Pro.</p> <p>The wave file can be found as "/tmp/sinewave.wav" during the working session(s) and can be saved anywhere of your choice.</p> <p>Enjoy...</p> <p>(Watch for word wrapping etc...)</p> <p>Bazza.</p> A simple shell script to keep the wife off of your back... (Bash) 2013-12-09T20:05:49-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578781-a-simple-shell-script-to-keep-the-wife-off-of-your/ <p style="color: grey"> Bash recipe 578781 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/reminder/">reminder</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/shell/">shell</a>). </p> <p>How many times have you been asked to remember to do something from the other half whilst she is out for a short while.</p> <p>For example: "You WILL check the dinner every few minutes won't you?"</p> <p>And how many times did/do you forget?</p> <p>Most of us have been there...</p> <p>This is a simple kids level, practical learning, shell script that generates an "xterm" with your reminder inside every 30 seconds for a period of 3 seconds.</p> <p>It is always be the active front window for 3 seconds at a time to _annoy_ you into remembering.</p> <p>Usage: reminder "What you have to remember here using spaces AND double quotes."&lt;CR&gt;</p> <p>Just reanme the downloaded script to reminder and remember to chmod it as required.</p> <p>Just run it from your default terminal and when finished press Ctrl-C just AFTER the xterm window closes.</p> <p>There is NO error detection so steer clear of any special characters in you reminder text.</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> Bash script to create a header for Bash scripts (Bash) 2011-11-02T01:57:07-07:00userendhttp://code.activestate.com/recipes/users/4179007/http://code.activestate.com/recipes/577862-bash-script-to-create-a-header-for-bash-scripts/ <p style="color: grey"> Bash recipe 577862 by <a href="/recipes/users/4179007/">userend</a> (<a href="/recipes/tags/auto/">auto</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/create/">create</a>, <a href="/recipes/tags/emacs/">emacs</a>, <a href="/recipes/tags/gpl/">gpl</a>, <a href="/recipes/tags/header/">header</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/vim/">vim</a>). Revision 3. </p> <p>This will create a header for a Bash script. It is a nice way keep a track of what your script does and when it was created, the author of the script, etc.. </p> <p>It will open the script automatically with one of the two most popular editor out there, Vim or Emacs! It also checks to see if there is a script with the same name in the current working directory so it will not overwrite another file.</p> <p>v0.4: I had to kick this up a notch. I took the suggestion of "dev h" to add a chance for the user to select another name for the script.</p> <p>Please leave comments and suggestions.</p> Pseudo-3D effect in text mode... (Bash) 2013-09-10T21:23:58-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578655-pseudo-3d-effect-in-text-mode/ <p style="color: grey"> Bash recipe 578655 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/3d/">3d</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/colour/">colour</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/text/">text</a>). </p> <p>This is just a simple DEMO to display a pseudo-3D effect using a bash script. It generates a recessed box and a button and writes some thext inside bot.</p> <p>There are two pieces of code, one for Linux, and one for OSX 10.7.5...</p> <p>The Linux version also works on OSX 10.7.5 but is harder to see so a near identical version using the default OSX terminal colours was craeted instead.</p> <p>You will have to split the two code pieces up yourself to run...</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza...</p> A FUN Bash Shell Bomb-Out Error Sound... (Bash) 2013-07-14T19:31:13-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578605-a-fun-bash-shell-bomb-out-error-sound/ <p style="color: grey"> Bash recipe 578605 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/error_beep/">error_beep</a>, <a href="/recipes/tags/error_sound/">error_sound</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/sound_exchange/">sound_exchange</a>, <a href="/recipes/tags/sox/">sox</a>). </p> <p>Do you remember the Bomb-Out icon(s) that appeared on some computers' SW and HW many years ago...</p> <p>Well this is a matching sound to go with it and can be used as a critical error sound.</p> <p>It sounds like a bomb being dropped from an aeroplane and is purely a shell sript only.</p> <p>It is set up to run SOund eXchange, SOX, but just by editing the code "/dev/dsp" can be used instead.</p> <p>Read the code for more informastion.</p> <p>Enjoy...</p> <p>Bazza...</p> DEMO - Generate A Crude 1KHz Sinewave Using A BASH Script. (Bash) 2013-03-01T19:41:47-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578477-demo-generate-a-crude-1khz-sinewave-using-a-bash-s/ <p style="color: grey"> Bash recipe 578477 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/sinewave/">sinewave</a>, <a href="/recipes/tags/sound/">sound</a>). </p> <p>A very simple crude sinewave generator using a BASH script inside a Linux Terminal.</p> <p>The file required is generated inside the code and requires /dev/audio to work.</p> <p>Ensure you have this device, if not the download oss-compat from your OS's repository...</p> <p>It lasts for about 8 seconds before exiting and saves a 65536 byte file to your working directory/drawer/folder as sinewave.raw.</p> <p>Use an oscilloscope to check the waveform generated...</p> <p>It is entirely Public Domain and you may do with it as you please...</p> <p>Enjoy finding simple solutions to often very difficult problems... ;o)</p> <p>Bazza, G0LCU...</p> A Building Block, Bash Binary File Manipulation... (Bash) 2013-01-29T22:07:57-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578441-a-building-block-bash-binary-file-manipulation/ <p style="color: grey"> Bash recipe 578441 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/shell/">shell</a>). Revision 2. </p> <p>Apologies for any typos, and IF this has been done before...</p> <p>The code generates a 256 byte binary file of _characters_ 0x00 to 0xFF for general usage and generates another binary file manipulated in a basic way.</p> <p>The for loops in the code are purely for DEMO purposes only.</p> <p>This is Public Domain and you may do with it as you please. I have uploaded it elsewhere too...</p> <p>Watch for wordwrapping, etc and read the code for more information...</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza, G0LCU...</p> A Shell, Binary To Hexadecimal To Decimal Demo... (Bash) 2013-01-11T18:31:03-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578413-a-shell-binary-to-hexadecimal-to-decimal-demo/ <p style="color: grey"> Bash recipe 578413 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/decimal/">decimal</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/hexadecimal/">hexadecimal</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/terminal/">terminal</a>). </p> <p>This little DEMO may be common knowledge to the big guns but not to amateurs like myself, so......</p> <p>This is an Apple Macbbok Shell/Terminal DEMO shell script to show how to:-</p> <p>1) Create a binary file... 2) Save it to your DEFAULT /directory/drwawer/folder/... 3) Display a hexadecimal dump of said binary file to prove that it is binary... 4) Select a single BYTE of that file and save it as an ASCII text decimal _number_, also to your DEFAULT /directory/drawer/folder/... 5) Read this ASCII text decimal number back in again... 6) Add this string representation to a number... 7) Stop...</p> <p>It was intended purely for OSX 10.7.5 and above using the default terminal and shell...</p> <p>It does work on many Linux flavours and shells/terminals also however.</p> <p>Written so the anyone can understand what is going on.</p> <p>The two files generated and saved in this DEMO to your DEFAULT /directory/drawer/folder/ are:-</p> <p>BinaryString.dat BinaryString.txt</p> <p>This WILL lead to something very unusual in the not too distant future...</p> <p>This is Public Domain and you may do with it as you wish...</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza, G0LCU...</p> A DEMO 6 Bit At A Glance Colouerd Bargraph Generator. (Bash) 2013-01-16T12:26:55-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578391-a-demo-6-bit-at-a-glance-colouerd-bargraph-generat/ <p style="color: grey"> Bash recipe 578391 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/analogue/">analogue</a>, <a href="/recipes/tags/anim/">anim</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bargraph/">bargraph</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/beep/">beep</a>, <a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/colour/">colour</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>). Revision 2. </p> <p>This code generates a horizontal coloured real time bargraph generator anim for a Macbook Pro 13 inch, OSX 10.7.5, using the default standard Terminal only.</p> <p>It is UNTESTED on Linux variants but I would like any successful Linux tryers to make a comment in the comments section and tags will be added accordingly otherwise I will assume it does NOT work on other UNIX like variants.</p> <p>It is a derivative of my 7 bit bargraph generator for Python on this site elsewhere.</p> <p>The Terminal colours WILL be changed on running but it is simple to return it back to its original state.</p> <p>Read the code for more information.</p> <p>Enjoy, (and a Happy New Year)...</p> <p>Bazza, G0LCU...</p> Basic Linux Menu (Bash) 2010-10-23T05:40:18-07:00Jonathan Fenechhttp://code.activestate.com/recipes/users/4169413/http://code.activestate.com/recipes/577437-basic-linux-menu/ <p style="color: grey"> Bash recipe 577437 by <a href="/recipes/users/4169413/">Jonathan Fenech</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/basic/">basic</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/menu/">menu</a>). </p> <p>A basic Linux menu which can do the following: </p> <ul> <li>Display Files and Directory's</li> <li>Remove Files Displayed</li> <li>Copy Files Displayed</li> <li>Make Directory</li> </ul>