BASH is the GNU Bourne Again SHell, the successor to the classic Unix Bourne sh (shell). It's the default shell for various GNU systems.
11
votes
6answers
599 views
Bash script that lowercases files
I have the following bash script that:
Finds all files with .cfc and .cfm extension and converts them to lowercase
Stores the ...
4
votes
1answer
27 views
Raspberry Pi headless server using bash and USB automounting
Revised from: Bash scripts and udev rules to handle USB auto mounting / unmounting
Tested:
Uses USB insert/remove to control a headless Raspberry Pi 3 with Raspian Jessie Lite
Changes:
Implement ...
2
votes
1answer
43 views
Bash scripts and udev rules to handle USB auto mounting / unmounting
Very new to Raspberry Pi and bash, but working on a headless server that will run a streaming app from USB audio card.
The plan is to take a USB card with settings file, and when inserted, the usb ...
3
votes
1answer
38 views
Shell script to display environment variables
This shell script writes my environment variables. If there is an argument, the shell script will grep for the argument in the environment variables.
...
6
votes
1answer
24 views
Script to download sequentially named files, rename them, and delete smaller files
I've written a little script to download sequentially named files, rename them, and delete files smaller than an certain number of kilobytes. I came up with this but I'm not too happy. Any advice for ...
4
votes
2answers
21 views
Isolate URLs from other text around it and put each on own line (with sed)
I have a small shell script that uses sed to take an input file of URLs with hand-written notes around them and strips the notes and puts each URL on its own line. ...
5
votes
1answer
35 views
Git tag release build files and reset to commit without
This is part of a library that wants to release builded files (eg dist/*) when published to npm and bower. However, I don't want to commit those builded files for ...
6
votes
0answers
20 views
Flac Converter And Organizer
I really like flac files, but my phone can't store them all. So I made a script for converting them, that slowly became a full featured flac organizer. I'd like to improve my programming skills, as ...
8
votes
1answer
87 views
Baby-sitting bash script using DVD drive
This is the script I wrote to make an automated POC baby-sitter in 5 lines.
I first found this on a GIF or meme site and thought of making a POC script that does the same.
...
4
votes
1answer
25 views
Parsing Gaussian09 frequency calculations, reformatting depending on desired output
Quite similar to my earlier review this script parses a frequency calculation and reformats the found values to either fit into one row for easier importing into a spreadsheet software or a formatted ...
7
votes
1answer
768 views
Bash script to simplify Git deployment workflow
In my company I follow the following workflow. (I think it can be defined a kind of 'Continuous Integration'.)
Workflow:
We have 3 fixed branches (staging/<...
4
votes
1answer
67 views
A little advanced mouse clicker in Bash for Linux
My today's goal was to create a little advanced mouse clicker in Bash for Linux powered by xdotool. This clicker implements 15 pixel random range in which it clicks ...
2
votes
2answers
15 views
Resolve dependencies from output of PBS queueing system
I have written a script, that reformats the output of qstat -f1 of the PBS queueing system. Unfortunately this project is by far too big to post here complete, also ...
10
votes
2answers
681 views
JSON Parsing in Bash
I have a json file which needs to be restructured.
The following is the code.
...
4
votes
2answers
39 views
Parsing Gaussian 09 output for energy statement on one or more files and reformat it to a table
I am a computational chemist working with the program Gaussian 09. After I manually check the output(s) I want to create a summary for easier processing of the obtained values. Also avoid opening all ...
3
votes
2answers
49 views
Bash script to perform LUHN check
The following Bash script takes a single parameter (the PAN) and exits with 1 if the PAN does not satisfy a LUHN check.
...
3
votes
1answer
35 views
Install ruby using rbenv in bash script
I want to write an automated bash script for installing ruby and rails using rbenv. But I am getting issue of session reload in terminal.
My bash script:-
...
1
vote
2answers
47 views
Crawling SPOJ through cURL and C++
I am trying to write industry standard code.
https://www.quora.com/How-do-I-follow-a-user-on-Spoj-for-solving-problems-Refer-Details
Someone gave me this A2A.
And I wrote this code for it
...
4
votes
2answers
90 views
MacPorts - Quick Install Script
I wrote this script to automatically install the relevant version of MacPorts.
It's supposed to be used in a fashion similar to the official installer for HomeBrew.
FYI: The real reason that I ...
1
vote
1answer
49 views
Write the running time to file without capturing the program's output
I want to run an application and write (append) its processing time into a file. Also, I want to see the stdout and stderr output on the shell, but don't want to write it in a file. After running the ...
4
votes
2answers
47 views
Sorting a file with three-line blocks by the second word of the first line in each block
I have a text file with the following three line pattern with blank lines in between. My script sorts alphabetically by each person's last name and preserves formatting. I would love to see other ...
2
votes
1answer
75 views
Testing a shell command interpretor
I've written tests that use Bash for testing a custom shell. I think the tests work but I'm sure you know better because this is my first test I write this way.
...
3
votes
1answer
29 views
Bash script that displays and kills selected processes
This is my first Bash script and I decided to use what I've learned so far to help manage stray processes while I develop in my *nix environs.
I've tested the script extensively and it seems to work ...
5
votes
2answers
56 views
Yet another bash backup script, using rsync --link-dest
I’ve written this bash backup script. It uses the --link-dest option of rsync; that way, the user have access to the backed data ...
5
votes
1answer
40 views
Bash script for xrandr modification
Simply, I call the script (brightness.sh) and pass a three character value as an argument. I've got commands to strip individual numbers for math processes, and then the final commands to apply the ...
2
votes
1answer
29 views
Open github via commandline
I'm learning bash and my goal here is from any repository on my computer to be able to type github and it will open the remote ...
2
votes
1answer
31 views
Read group of keywords from file, modify value, store new group to variable
I would like to use the following routine in my submission script for GAMESS calculations. I am not entirely sure if this is the optimum way to go.
This function would need one of the messaging ...
4
votes
1answer
36 views
Checking if input file exists, assign output file destination, prevent overwriting any files
I would like to use the following routines in my submission script for GAMESS calculations. Before I do, I would like to get some input if I can improve it somehow.
The three messaging routines (<...
4
votes
2answers
462 views
SSH passing your Public key to all the users on remote host
I've grown tired of typing my password back and forth to all the hosts you connect to, i want to be able to jump to every single user on all the hosts with ease.
So i've made this script with a ...
4
votes
1answer
55 views
Bash script to determine a distro, update, upgrade and install the apps I use
This is my first bash script. I am trying to learn scripting and needed an idea. This is the first idea I came up with. When I used to distro hop I had to reinstall everything. This helped me out once ...
2
votes
0answers
37 views
Bashscript - Find and run main.py file (part of vim-Python IDE)
I try to get into Python and thought I build together my own IDE. Most of it consists of different addons for vim and changes in the vimrc (which of course I simply copied of google), but I also ...
1
vote
1answer
33 views
Setting up a development environment - 2
This is the new code after following the advice from here:
Setting up a development environment
General feedback is requested. Also, should I be using $() or <...
7
votes
1answer
332 views
Setting up a development environment
I'm looking for feedback on improving the structure of this code. Also, I could not find the command line executable for Chrome.
General feedback is also requested.
...
4
votes
1answer
36 views
Using arrays to read in file, append it with parsed program output and overwrite original
Yesterday a friend of mine asked on U&L: How to optimize 'grep'-and-save?
I will summarise shortly. The output of the torque pbs queueing system tool qstat ...
2
votes
1answer
22 views
Wordpress downloader and unpacker
Wrote a small bash-script today that downloads the latest swedish wordpress archive , extracts it and writes wp-config.php
Would appreciate any feedback that could improve it / prettify it.
The ...
4
votes
1answer
58 views
Watch log dir for new file, automatically tail to slack
We have a process that outputs to log files in the format /var/log/xxx/YYYY_MM_DD.log - the file name is chosen programmatically and is not rotated using logrotate ...
3
votes
1answer
55 views
2
votes
1answer
34 views
Bash script menu
Any comments on this?
Like there is a way to get rid of all the if-statements or a better way to # check model and build (which ...
4
votes
1answer
26 views
Making time lapse screenshots using Bash
My experience in bash is... well, around the Bourne shell on AIX. I wrote a semi-complex script in Bash, and I feel that it could be improved in 100 different ways.
The Github project is here: https:/...
0
votes
0answers
51 views
Resolving the path to a Bash script
I wrote a function to resolve the full path to the current Bash script, and I'm wondering if it's SOLID:
...
4
votes
1answer
40 views
Search and merge split-archive backup parts
I wrote some code which searches parts of a split-archive backup (it's an Android backup, I used flashfire to backup) and rejoins them. As you can easily see, I've achieved this by ...
2
votes
1answer
32 views
Locating the Bash history file for a user
This looks quite verbose to me, using the command substitution and echo:
...
2
votes
0answers
38 views
Start the Python interpreter with an import statement
When I'm writing Python, I wanna be able to pull up an interpreter quickly, and import what I need easily. Previously, this involved:
...
8
votes
1answer
92 views
A Dockerfile for Composer (a dependency manager for PHP)
I recently built a Docker image for Composer. I'd love to get a review of the image, the Bash based wrapper script, its recommended use, and the repository structure.
Here's the Dockerfile for the <...
4
votes
2answers
82 views
Un*x terminal history wiper
Using various answers from Stack Overflow and Ask Ubuntu, I've hacked together this simple C program that wipes terminal history. It works but I'm relatively new to C so I'm not sure if everything is ...
3
votes
1answer
34 views
Generates a randomized locally-administered unicast MAC address
This is the first time I've attempted writing something in bash, and would appreciate any feedback or criticism to make it better.
...
2
votes
1answer
32 views
Bash script to create directories and files with a numbered prefix
I wrote a pretty simple bash script. It takes a directory with subdirectories with incremental prefixes in their names (01test, 02test, 03test), creates a new ...
4
votes
2answers
56 views
Bash “Rotating” MySQL backup
I'm quite a novice in shell scripting so far, but i'm learning and getting quite comfortable in writing shell scripts, but i have a lot to learn.
The snippet at the bottom of the page creates backups ...
2
votes
1answer
20 views
Shell agnostic startup flow - env, profile, rc, login
The goal of these files is to have some common behavior between Bash and Zsh
when starting them. As is known, when Bash starts as a login shell it will
source the first found of the following in your ...
5
votes
1answer
38 views
Bash script to open or close gnome-terminal with a single keybinding
I wanted to bind a single hot key to open and close gnome-terminal in a way similar to terminal emulators such as tilda or guake. I use Ubuntu, and have configured this script to be executed when I ...