Popular recipes tagged "bash"http://code.activestate.com/recipes/tags/bash/2017-03-25T14:12:25-07:00ActiveState Code RecipesA simple Unix shell utility to save cleaned-up man pages as text (Bash) 2017-03-25T14:12:25-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580766-a-simple-unix-shell-utility-to-save-cleaned-up-man/ <p style="color: grey"> Bash recipe 580766 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/documentation/">documentation</a>, <a href="/recipes/tags/man/">man</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>It's a shell script that lets you save the man pages for one or more Unix commands, system calls or other topics, to text files, after cleaning up the man command output to remove formatting meant for emphasis, printing, etc.</p> <p>More information here:</p> <p><a href="https://jugad2.blogspot.in/2017/03/m-unix-shell-utility-to-save-cleaned-up.html" rel="nofollow">https://jugad2.blogspot.in/2017/03/m-unix-shell-utility-to-save-cleaned-up.html</a></p> A utility like Unix seq (command-line), in Python (Python) 2017-01-08T17:48:57-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580744-a-utility-like-unix-seq-command-line-in-python/ <p style="color: grey"> Python recipe 580744 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/command/">command</a>, <a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/seq/">seq</a>, <a href="/recipes/tags/sequence/">sequence</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/unix/">unix</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>This recipe shows how to create a utility like Unix seq (command-line), in Python. seq is described here: </p> <p><a href="https://en.wikipedia.org/wiki/Seq_%28Unix%29" rel="nofollow">https://en.wikipedia.org/wiki/Seq_(Unix)</a></p> <p>but briefly, it is a command-line utility that takes 1 to 3 arguments (some being optional), the start, stop and step, and prints numbers from the start value to the stop value, on standard output. So seq has many uses in bigger commands or scripts; a common category of use is to quickly generate multiple filenames or other strings that contain numbers in them, for exhaustive testing, load testing or other purposes. A similar command called jot is found on some Unix systems.</p> <p>This recipe does not try to be exactly the same in functionality as seq. It has some differences. However the core functionality of generating integer sequences is the same (but without steps other than 1 for the range).</p> <p>More details and sample output are here:</p> <p><a href="https://jugad2.blogspot.in/2017/01/an-unix-seq-like-utility-in-python.html" rel="nofollow">https://jugad2.blogspot.in/2017/01/an-unix-seq-like-utility-in-python.html</a></p> <p>The code is below.</p> Collection Pipeline in Python (Python) 2016-03-16T14:45:02-07:00Steven D'Apranohttp://code.activestate.com/recipes/users/4172944/http://code.activestate.com/recipes/580625-collection-pipeline-in-python/ <p style="color: grey"> Python recipe 580625 by <a href="/recipes/users/4172944/">Steven D'Aprano</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/filter/">filter</a>, <a href="/recipes/tags/map/">map</a>, <a href="/recipes/tags/pipe/">pipe</a>, <a href="/recipes/tags/pipline/">pipline</a>). </p> <p>A powerful functional programming technique is the use of pipelines of functions. If you have used shell scripting languages like <code>bash</code>, you will have used this technique. For instance, to count the number of files or directories, you might say: <code>ls | wc -l</code>. The output of the first command is piped into the input of the second, and the result returned.</p> <p>We can set up a similar pipeline using Lisp-like Map, Filter and Reduce special functions. Unlike the standard Python <code>map</code>, <code>filter</code> and <code>reduce</code>, these are designed to operate in a pipeline, using the same <code>|</code> syntax used by bash and other shell scripting languages:</p> <pre class="prettyprint"><code>&gt;&gt;&gt; data = range(1000) &gt;&gt;&gt; data | Filter(lambda n: 20 &lt; n &lt; 30) | Map(float) | List [21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0] </code></pre> <p>The standard Python functional tools is much less attractive, as you have to write the functions in the opposite order to how they are applied to the data. This makes it harder to follow the logic of the expression.</p> <pre class="prettyprint"><code>&gt;&gt;&gt; list(map(float, filter(lambda n: 20 &lt; n &lt; 30, data))) [21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0] </code></pre> <p>We can also end the pipeline with a call to <code>Reduce</code> to collate the sequence into a single value. Here we take a string, extract all the digits, convert to ints, and multiply:</p> <pre class="prettyprint"><code>&gt;&gt;&gt; from operator import mul &gt;&gt;&gt; "abcd12345xyz" | Filter(str.isdigit) | Map(int) | Reduce(mul) 120 </code></pre> A UNIX-like "which" command for Python (Python) 2015-03-20T19:23:45-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579035-a-unix-like-which-command-for-python/ <p style="color: grey"> Python recipe 579035 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/commands/">commands</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/unix/">unix</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/which/">which</a>). </p> <p>UNIX users are familiar with the which command. Given an argument called name, it checks the system PATH environment variable, to see whether that name exists (as a file) in any of the directories specified in the PATH. (The directories in the PATH are colon-separated on UNIX and semicolon-separated on Windows.)</p> <p>This recipe shows how to write a minimal which command in Python. It has been tested on Windows.</p> Obfuscation In Bash Shell. (Bash) 2014-12-19T20:01:30-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578986-obfuscation-in-bash-shell/ <p style="color: grey"> Bash recipe 578986 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/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/obfuscation/">obfuscation</a>). </p> <p>IMO, the immense power of the shell...</p> <p>Please let me know if there is any other human readable language that can do this...</p> <p>The DEMO code below was an idea I formed to see how to make a bash script very difficult to hack.</p> <p>Everything in it is made easy to read so as to see this idea working.</p> <p>It uses bash variables ONLY and although I have used bash loops to create the variables in this DEMO you could create your own set of variables and 'source' them to the the obfuscated code before running the main body of the code.</p> <p>It also goes without saying that you could obfuscate the changing of any or all the variable allocations at any time AFTER the code runs to make it even more obfuscated and as may times as you wish...</p> <p>I would be seriously difficult to actually write a lsrge bash app' using this method but boy oh boy would it be fun?!?</p> <p>Testbed:- Macbook Pro, OSX 10.7.x and above, using default bash terminal...</p> <p>LBNL, yeah I am aware of 'eval' but as it is obfuscated and can have as many obfuscated variables as I wish allocated to it then why worry... ;o)</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza...</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> Get external IP & geolocation in bash. (Bash) 2014-11-30T00:46:28-08:00manuhttp://code.activestate.com/recipes/users/4191225/http://code.activestate.com/recipes/578972-get-external-ip-geolocation-in-bash/ <p style="color: grey"> Bash recipe 578972 by <a href="/recipes/users/4191225/">manu</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/geocoding/">geocoding</a>, <a href="/recipes/tags/geolocation/">geolocation</a>). Revision 2. </p> <p>Very simple way to get external IP and geolocation uysing dig and geoiplookup.</p> <p><code>dig</code> is cool to obtain my external IP and I use <code>geoiplookup</code> to convert IP to location. You need geoip-bin and, geoip-database (and/or geoip-database-contrib and geoip-database-extra). In Debian, database seems update monthly.</p> <p>It's just a tip.</p> A Fun Perfect Square Checker Using Integer Arithmetic Only... ;o) (Bash) 2014-09-16T22:27:04-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578934-a-fun-perfect-square-checker-using-integer-arithme/ <p style="color: grey"> Bash recipe 578934 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/arithmetic/">arithmetic</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/check/">check</a>, <a href="/recipes/tags/checker/">checker</a>, <a href="/recipes/tags/cygwin/">cygwin</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>, <a href="/recipes/tags/perfect/">perfect</a>, <a href="/recipes/tags/root/">root</a>, <a href="/recipes/tags/square/">square</a>). </p> <p>A recent Python upload here gave me the inspiration to do a bash version... This is a little tongue-in-cheek but an enjoyable bit of fun.</p> <p>It took around 11 seconds to prove 90000000000 had a perfect square of 300000...</p> <p>It is a stand alone program and has a degree of INPUT error correction...</p> <p>It was done on a MacBook Pro, OSX 10.7.5, default bash terminal and should work on Linux flavours but it is untested...</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza...</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> Zenity Chunk Editor, creating an hashing to preserve Code Integrity. (Bash) 2013-10-22T01:30:42-07:00Patrick Riendeauhttp://code.activestate.com/recipes/users/4175653/http://code.activestate.com/recipes/578693-zenity-chunk-editor-creating-an-hashing-to-preserv/ <p style="color: grey"> Bash recipe 578693 by <a href="/recipes/users/4175653/">Patrick Riendeau</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/debian/">debian</a>, <a href="/recipes/tags/development/">development</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/mint/">mint</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/ubuntu/">ubuntu</a>). </p> <p>It Open by default a uuid-like temporary file. There is no actual was to modify the name, but assuming the implementation of ZenityShellEval imply a limited acces to shell, you might recuperate information from shell or futur adding to transfer a name or simple renaming the uuid-like file-name... This is to prevent auto-execution of a script from canned-design by playing with without having all clearly create your shell script and/or having fully pseudo-code explained and having confirmation of your design work...</p> <p>Initially, the shell Editor look like this : is: <img src="https://github.com/priendeau/Fnct.d#ZenityShellEval" alt="Image of Zenity Shell In action" /></p> <p>The dependency are simple, it require My GitHub Fnct.D project, available here: <code>[link](https://github.com/priendeau/Fnct.d)</code> to be installed inside /etc/init.d/Fnct.D like this </p> <p>git clone <a href="https://github.com/priendeau/Fnct.d" rel="nofollow">https://github.com/priendeau/Fnct.d</a> /etc/init.d/Fnct.D</p> <p>and loading the Lib first:</p> <p>. /etc/init.d/Fnct.D/fnct_lib </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> Bash style commands (Bash) 2013-08-22T13:05:29-07:00greg zakharovhttp://code.activestate.com/recipes/users/4184115/http://code.activestate.com/recipes/578648-bash-style-commands/ <p style="color: grey"> Bash recipe 578648 by <a href="/recipes/users/4184115/">greg zakharov</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/cmd/">cmd</a>). </p> <p>This is just a concept. To import bash style commands use "script.cmd /bash", to get the list of imported commands use "script.cmd /map"</p> Bash style commands (Batch) 2013-08-22T13:06:33-07:00greg zakharovhttp://code.activestate.com/recipes/users/4184115/http://code.activestate.com/recipes/578649-bash-style-commands/ <p style="color: grey"> Batch recipe 578649 by <a href="/recipes/users/4184115/">greg zakharov</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/cmd/">cmd</a>). </p> <p>This is just a concept. To import bash style commands use "script.cmd /bash", to get the list of imported commands use "script.cmd /map"</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> Bash Script For An Oscilloscope... (Bash) 2013-06-19T19:06:50-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578570-bash-script-for-an-oscilloscope/ <p style="color: grey"> Bash recipe 578570 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/anim/">anim</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/audioscope/">audioscope</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/oscilloscope/">oscilloscope</a>, <a href="/recipes/tags/scope/">scope</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/sound_exchange/">sound_exchange</a>, <a href="/recipes/tags/sox/">sox</a>, <a href="/recipes/tags/terminal/">terminal</a>). </p> <p>This code is the latest as of 19-06-2013. It is an AudioScope designed around a Macbook Pro 13" of which only has ONE microphone input. It works under Linux variants too. Read the code for much more info.</p> <p>It was my way of learning Bash scripting.</p> <p>It is resident here at this site:-</p> <p><a href="http://www.unix.com/shell-programming-scripting/212939-start-simple-audio-scope-shell-script.html" rel="nofollow">http://www.unix.com/shell-programming-scripting/212939-start-simple-audio-scope-shell-script.html</a></p> <p>It started off as a fun idea and is now becoming a very serious project.</p> <p>As it stands this is fully working but it is uncalibrated and this is where it will stay on this site.</p> <p>As the above site is the host then all future uploads will be there...</p> <p>To do list...</p> <p>DC input. [1] DC polarity. [1] 2 more Internal sync modes. External triggering. Zoom facility - if possible in text mode. Vertical calibration. [2] Frequency measurement. {3] (Others.)</p> <p>[1] I have simple HW built as an idea but yet to prove it... [2] Preliminary HW built but not yet used. Calibration SW and circuit(s) to be built into script as it progresses. [3] I already have a working script but not completely satisfied at it at this point...</p> <p>I am noing to say much else except that it has already been given a 5 star rating on the above UNIX site...</p> <p>As it stands this code is entirely Public Domian and you may do with it as you please...</p> <p>Enjoy something completely different using Bash scripting...</p> <p>Finally the code defaults to a DEMO mode which requires no HW access at all but everything is still functional...</p> <p>__Thoroughly__ read the code for more information...</p> <p>As a circuit is inside the script then it is best viewed in plan text mode.</p> <p>Bazza, G0LCU.</p> Two Versions Of Bash One Liner INKEY$ Functions... (Bash) 2013-03-28T17:51:32-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578502-two-versions-of-bash-one-liner-inkey-functions/ <p style="color: grey"> Bash recipe 578502 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/inkey/">inkey</a>, <a href="/recipes/tags/shell/">shell</a>). Revision 2. </p> <p>This is probably common knowledge to the professionals but not so much for amateurs like myself.</p> <p>This is a code snippet for the equivalent of BASIC's...</p> <p>LET char$=INKEY$</p> <p>As the timeout parameter cannot be less than 1 second then this is the only limitation...</p> <p>It is a single line function which has a variable "char"...</p> <p>Read the code for more information...</p> <p>There are now two versions, edit out and choose which is best for you...</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>