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.
8
votes
1answer
827 views
Guessing the JDK home directory
My project is using a specific version of JDK which is jdk-6 and the default JDK_HOME path will vary from distribution to distribution, so I wrote a script to guess it. Is there any way to do this ...
3
votes
1answer
16 views
Get bibtex entries from metadata of PDF files
When I have to write a report or an article, I usually have my bibliography as PDFs in a specific folder, so I wrote this script to automate the generation of bibtex entries.
It works so far, but I'd ...
1
vote
1answer
67 views
Simple Linux upgrade script in Bash revision 2
As I will be deploying this script on multiple machines with the very same system Linux Mint 18 with rather same configuration, I would like to be semi-sure I won't screw things up much.
This little ...
6
votes
1answer
73 views
Simple Linux upgrade script in Bash
As I will be deploying this script on multiple machines with the very same system Linux Mint 18 with rather same configuration, I would like to be semi-sure I won't screw things up much. This little ...
2
votes
1answer
17 views
Script to execute arbitrary command on each Git project in a directory
The idea is simple, most people have some one directory containing all their projects as subdirectories. When you are in the top directory and you run this script like so ...
4
votes
2answers
58 views
Optimize text search in files with Bash
I would like to get some performance improvement suggestions to a simple project I made using Bash in Linux.
The target is to read all the *.desktop files, and ...
3
votes
1answer
34 views
ECG Bash selection tool
I made the following bash script for extracting a group of ECG signals from ECG files. I would like to know if there is any mistakes and/or weaknesses. I have experienced difficulties in integrating ...
1
vote
2answers
38 views
Excluding a long list of words with grep
This Bash program extracts the 20 first lines of each man page present on a system and uses grep to remove lines matching a list ...
3
votes
0answers
38 views
Daemonizing shell scripts - MqSH
This is an mqtt driven, interactive, and asynchronous remote shell daemon written in bash. I call it "MqSH" or simply "mq". It works with bash, the busybox ash shell, and perhaps other Bourne-like ...
3
votes
1answer
20 views
OpenVPN Authentication Script
I wrote a shell script to authenticate users connecting to an OpenVPN server. When a user attempts to connect, OpenVPN executes the script with the username and password variables sends.
The script ...
4
votes
0answers
27 views
Semaphore implementation by file locking in a bash script
This implementation is inspired by the POSIX functions sem_wait() and sem_post(). It tries to get rid of busy loops in the code ...
5
votes
1answer
60 views
Game of Life Kata in Bash
I've implemented a Game of Life Kata with the aim to get to know Consul's K/V store. Although not the main purpose of the exercise, it would be nice if somebody reviewed some of the bash code in the ...
2
votes
2answers
48 views
Passing help options to a bash script
I used this code to give -h(help) options to my bash script. It's working fine and I wanted to get the code reviewed.
...
3
votes
1answer
28 views
Filetype backup script
This was one of my assignments in which I had to create a backup script that will individually compress all files (of an arbitrary number) of file-types (indicated by their .extension).
Example: <...
3
votes
1answer
14 views
Merging directories and keep files that have more lines
Goal
My goal is to merge directories. Whenever a file has the same name in two or more directories, then only the one that has the highest number of lines should be kept. If both files have the same ...
3
votes
1answer
53 views
Backup MySQL database for Django projects
I have a usual Django application with a single MySQL database. The purpose of this shell script is to backup a MySQL database every midnight by crontab and check that everything goes right.
The ...
4
votes
2answers
57 views
Generate SQL UPDATE from Excel CSV file
I must write updates in a database from a flat file (CSV). I want to do that in the shell, with tools such as AWK.
...
5
votes
1answer
45 views
Bash function that allows running user aliases with sudo on Ubuntu
I wrote this little Bash function to replace my sudo command.
It checks whether I have an alias for the given command and runs the aliased command instead of the ...
2
votes
2answers
34 views
High CPU utilisation for Logs Manager shell script
I have written a shell script to manage the tcpdump pcap logs and syslog files in my Linux board, so as to maintain the disk usage to maximum of 70%.
The script checks for the disk usage every ...
2
votes
1answer
34 views
Fahrenheit / Celsius temperature converter - follow-up
This is an updated version of the script Fahrenheit / Celsius temperature converter. I have changed the script to be non-interactive, using positional parameters instead of asking for user input once ...
2
votes
0answers
49 views
Log all Google Chrome browser activity
This script documents every website visited and writes the text content of each webpage to its own individual file. It seems to work as intended. Is there anything I could do to improve it?
...
3
votes
1answer
53 views
Bash manual page selection menu
I wrote the following script in the hopes of streamlining the finding and reading of multiple manual pages. Since I am always looking up different utilities' manual pages I thought this would a good ...
3
votes
2answers
51 views
Counting unique visitors in access log
I'm aware I am probably reinventing the wheel somewhat here, but I am trying to teach myself simple bash coding by completing simple tasks such as parsing files.
To that end I am looking to learn ...
1
vote
2answers
54 views
Iterating over a range of dates in a shell script
I have been working on a script that can be used to automatically pull the batch ids that were processed 4 days ago and which need to be processed tomorrow on the server. The batch IDs from 3 days ago ...
4
votes
1answer
99 views
5
votes
2answers
397 views
Fahrenheit / Celsius temperature converter
This is a simple bash script (hopefully with a little style as well) for converting temperatures from Fahrenheit to Celsius and vice versa.
...
5
votes
1answer
33 views
Customized date and time display
A simple reworking of the Bash date command to my own personal liking. Possibly a rather trivial task; I just wanted the date and time to be in the form of:
...
4
votes
2answers
56 views
Bash script for setting up a LAN to WLAN router
I wrote a bash script for the Raspberry Pi 3 (Raspbian) which has the main task of setting up a LAN to WLAN router. In addition it makes some things nicer for the intended users who have Windows ...
3
votes
1answer
40 views
3
votes
0answers
78 views
Laravel Docker-Compose
I've created a repo for some Docker containers that work together with docker-compose to make a very easy and quick installation for Laravel including nginx, mariadb, and redis. Laravel is known for ...
5
votes
1answer
49 views
`ls` indicates when directory is empty/full of dotfiles
I want ls to print a message when run on an empty or full of dotfiles directory. Instead of:
$ ls empty_dir/ dotfiles/
$
I ...
3
votes
1answer
32 views
Moving WordPress database and files to new host
I've written a script in an attempt to try to automate moving hosts from old hosts to our new docker containers.
All feedback and input appreciated!
...
3
votes
3answers
63 views
Collect, filter and display archive logs on demand
Wrote a php site to gather/filter/search daily archived logs from the archive directory using bash cat and ...
2
votes
1answer
36 views
Shell script to archive files to AWS S3
This is a simple script that moves files to S3 if they are > 14 days old. It ignores files that are < 14 days old. If the file is successfully synced to AWS S3 then we can remove it from the server....
0
votes
0answers
45 views
Robust bash function to find the root of a git repository
I'm trying to write robust code which will print the root directory of a git repository.
How can I improve this code for:
Robustness
Style (eg use of subshell ...
6
votes
1answer
44 views
Extracting Linux configuration information using Bash and Perl
For few days I'm thinking about making my code faster and using less CPU. This code is a statusbar that runs in a loop. I'm asking because there's a lot of perl and I'm wondering if it could be done ...
2
votes
1answer
83 views
Shell script wrapper for Docker build and run
I have written a simple wrapper for docker build and docker run that allows me to build and run my image without having to use ...
6
votes
1answer
104 views
Coloured bash prompt including git status and previous exit code
I wanted to create a short, informational and colourful prompt.
My prompt includes:
Exit status of last command (if not 0)
Distinctive changes when root
rsync-...
4
votes
1answer
33 views
Yum Notification Script
This is a Bash script I wrote to email me when updates are available for my server. I'm new to bash programming, so I don't know if I've done this well.
...
5
votes
1answer
16 views
Script to record an inventory of a backup
This is a script designed to make an inventory file which records the
contents of a directory allowing verification that a backup has the
same data. The same script can also
A full github repo is ...
4
votes
1answer
48 views
Server setup script for Redis, HAProxy and Node.js
I wrote a pretty basic setup script that handles most of the setup for a Three-server solution. The solution and setup file are available on GitHub
The three servers are Redis, HAProxy and Node / ...
6
votes
3answers
86 views
Bash script to extract HTML comment into a Markdown file
I learned Bash a million years ago. I just wrote this simple script used to get the first lot of HTML comments from a file, and spit it out in order to create a ...
12
votes
6answers
720 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
87 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
81 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
50 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
40 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
25 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. ...
6
votes
1answer
98 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
26 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 ...