Questions tagged [bash]

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.

Filter by
Sorted by
Tagged with
4
votes
0answers
68 views

appleseed command line widget (CLW)

─── appleseed on GitHub appleseed v1.0.0 is a command line widget (CLW), I designed for macOS and iTerm2. Its a flexible platform for process automation and added eye candy. It utilizes ...
2
votes
1answer
28 views

Finding (and counting) duplicate JS/Java files

I have the following script which takes minutes to give output. ...
4
votes
3answers
68 views

Write bootable image to USB device

Recently, I've been making and refining installer and rescue images to boot from USB media, in the form of CD-ROM or hard disk images. After a few occasions where I re-ran the command after removing ...
1
vote
1answer
100 views

Read integers from text file and write to CSV file

Background: I've recently started learning bash due to my new job in a VFX company. We backup all of our media to LTO tapes (one master and one clone). I was tasked with writing a script that split ...
1
vote
1answer
40 views

Nginx-WordPress conf

This is how I create am Nginx virtual host for a WordPress webapp. I did best to keep it as minimal as I can while having a working webapp. Please review it: ...
3
votes
1answer
1k views

Rsync script that does Daily, Weekly and Monthly backups with hard links

I have not been able to find a good implementation of using rsync to do daily, weekly and monthly backups with hard links anywhere. So I wrote my own and I am now looking for critique before I set it ...
7
votes
2answers
206 views

Bash script to temporarily run a shell without certain group memberships

I have here a script called rwog (run without groups) that allow a user to run a shell without particular group memberships. ...
2
votes
2answers
93 views

Nginx-WordPress installer for Debian

I have written the following Bash script which includes an Nginx WordPress bootstrapper: A program establish WordPress apps fast on a Debian-Nginx environment. It utilizes CertBot for HTTPS, SSHguard ...
3
votes
2answers
50 views

Bash script for managing hashtag notes

I have written a simple script for managing hashtag notes. I am not familiar with bash scripting so I would really appreciate it if someone could give me some pointers about it. ...
11
votes
5answers
2k views

Git delete all merged in local branches

I have written a shell script utility for deleting all merged local branches. ...
4
votes
1answer
107 views

A bash prompt that includes battery level & git branch

Is there a better way to handle the color codes and display git branch and battery percentage? ...
0
votes
1answer
38 views

MySQL CLI: Create a MySQL user & DB

Please review my Bash code to create an authenticated, all privileged MySQL user plus a DB with the same name, through the MySQL CLI: ...
1
vote
1answer
47 views

Using extdebug to display where a function was defined

I wrote a tool similar to which that would display the file and line number where a function was defined. Is there a way I can do the same for aliases? Also, any ...
1
vote
1answer
35 views

Four-lines script to make an immediate DB and document root zip backup

What do you think of my script to make an immediate DB and document root zip backup? Any flaw you might find. Please inform me of it: ...
3
votes
1answer
256 views

Reset files in Git which show as modified but have no changes according to “git diff”

This seems to be working but also is quite horrendously slow and seems a little hacky to me. ...
3
votes
1answer
77 views

Create a WordPress site data with Nginx app data automatically

The following script is aimed for Ubuntu >=16.04 LEMP environments with PHP-FPM >=7.0, MySQL, WP-CLI, Certbot, and ...
4
votes
2answers
51 views

Bash function to generate colored output

I like to user colored output in my interactive shell scripts. I've been using Ubuntu and bash for a long time, but haven't done much bash scripting. I'd appreciate a review of this function for ...
5
votes
2answers
85 views

Goodgame Empire coin collector with random offsets in (almost-POSIX) Bash

Today, my goal was again to improve my POSIX shell scripting abilities. In one MMO game called Goodgame Empire, there is possible to code yourself a coin (tax) collector. But that's of less ...
4
votes
2answers
77 views

Measuring typing speed in terminal without a mistake

I tend to dislike my code. It's always a mess. I can't critique my own code though, because I just turn it into another mess. I've been programming slightly better every year, but this year it has ...
2
votes
1answer
47 views

Changing php.ini with code in a LEMP stack on Debian systems

This is how I establish a Debian LEMP and use code to change php.ini directives, as part of php-fpm. Please review the way I change ...
5
votes
1answer
59 views

Sed script that removes specific lines in `seq` output

I have a file to process with sed but I am not quite familiar with the commands with capital letters used for multi-line patterns. I use ...
2
votes
1answer
33 views

S3 Bash Tools Part 3

This is a follow on to a previous question: Part 3: User Scripts All the code I am submitting here is available in github The reason to write these tools is so I can prototype and quickly verify ...
1
vote
0answers
20 views

S3 Bash Tools Part 2

This is a follow on to a previous question: Part 2: Upload/Download All the code I am submitting here is available in github The reason to write these tools is so I can prototype and quickly ...
1
vote
0answers
62 views

S3 Tools in Bash

This is a follow on to a previous question: Part 1: Signature All the code I am submitting here is available in github The reason to write these tools is so I can prototype and quickly verify ...
1
vote
1answer
54 views

Ubuntu-Nginx lightweight server environment setup

Please review the following Bash script that uses to establish a "lightweight" Ubuntu-Nginx server environment mainly aimed to run small WordPress sites (about 5 plugins, about 25 webpages, about 25 ...
2
votes
1answer
104 views

Webapp Substrate script for WordPress on Debian-Nginx

The following script creates a webapp substrate for WordPress webapps/websites on Ubunu-Nginx with PHP-FPM and Mysql environments, with Certbot, while all software is uncustomized. Such substrate ...
2
votes
1answer
93 views

Nix cron daily and weekly scripts for a minimal Nginx server environment

I've created the following Nix cron for daily and weekly scripts for a minimal Nginx server environment (as part of my larger script). The daily cronjob updates WordPress and brings back original ...
4
votes
0answers
215 views

WSL LAMP stack script

The following code is aimed to establish a WSL based LAMP environment. This is instead XAMPP or WAMPP based LAMP environment which doesn't allow Bash. The script includes a cat heredocument called "...
4
votes
2answers
68 views

Determine if .deb package is installed using Bash

I was able to use dpkg-query to determine if a package is installed on Ubuntu, but it's a bit of a mess because the name used to install the package doesn't always align with what it's installed as. ...
2
votes
1answer
67 views

Check SMART status on MacOS and pop up alert

So I don't know much about bash scripting. I am just a beginner. I made this script which checks the SMART status of my root volume and if it is failing then it immediately throws a pop up alert if ...
1
vote
1answer
28 views

Script that makes an API call to and parses the response to get a URL from where to download another file

This is my first script and I am having a hard time writing the shortest possible code. ...
3
votes
2answers
48 views

Safely pruning merged topic branches locally

Background My team develops in a git monorepo. User stories are broken into very small discrete sub-tasks and merged directly into master, rather than into a ...
1
vote
1answer
122 views

Shell script to create a boilerplate proyect

This is actually my first shell script and just by looking at it I know this can look better. I use Elixir and Phoenix for most of my projects and I started using Zurb Foundation 6, changing from ...
3
votes
1answer
68 views

Restart network-manager service if connection down on wake shell script

I use Ubuntu (Trusty and Xenial) and usually put my computer in sleep mode rather than power it down. A common problem is that upon wake the network is down so one has to restart the network-manager ...
3
votes
0answers
90 views

Follow-up: Script to create symlinks for dotfiles in a Git repository

This is a follow up to my previous question on Code Review. I did try to implement most of feedback provided by thiagoalessio. This is what my updated code looks like: ...
4
votes
1answer
287 views

Script to create symlinks for dotfiles in a Git repository

I have a GitHub repository containing all my dotfiles for bash, tmux and neovim. I'm using a ...
3
votes
0answers
32 views

Bash webapp duplicator

I've written the following Bash script used to duplicate a webapp/website you have (say, a Wordpress website) locally on your server environment, for testing purposes, indicating after 2 days if you ...
3
votes
2answers
60 views

Password string generation

I'm trying to create passwords using the following snippet to match a custom password policy. I've added three gtr statements, at the end of the string, to ...
2
votes
1answer
67 views

Bash script to validate a MySQL database

I am fairly new to bash script programming so I would love some feedback. I am trying to write a series of migration scripts for our DBs (please don't direct me to other tools; I spent a lot of time ...
4
votes
1answer
80 views

Optimize and accelerate bash script to transform XML to SQLITE

I have this script in which I read an XML and I pass it to CSV and at the end of the script I transform it into SQLITE ...
6
votes
2answers
767 views

Loading records from an XML file into SQLite

I have a script and I need to optimize it to reduce the execution time of this, currently, 6000 lines takes 1 minute and 38 seconds, I would like to reduce the time to take much less and I do not know ...
3
votes
1answer
270 views

Finding a Bash script's Runfiles as generated by Bazel

When building a sh_binary with dependencies using Bazel, a tree of Runfiles containing the dependencies is generated: ...
4
votes
2answers
82 views

Bash Database Backup to AWS S3

I've written a bash script that backs up databases and uploads the backups to an S3 bucket. I have the bucket configured to delete backups that are older than 90 days. Is there anything that can be ...
2
votes
1answer
94 views

Init.d script for Rails managing a Rails app via Unicorn

This script is to enable the remote management of a Rails app via one script. I pieced it together from various blog posts. I am not to familiar with some of the BASH functionality that is used. It ...
2
votes
1answer
657 views

bash script - sed - template file processing

Using a bash script to process a file and pass it to AWS CLI. The script runs inside a docker container. I'm using sed to do template string replace. When MY_VALUE ...
6
votes
2answers
515 views

Bash script that counts the characters, frequency, and percentage of letters in Spanish sonnets

This script will be used to analyze a lot of old Spanish sonnets. I have tested it thoroughly and all seems to be working perfectly. However, I want to make sure I am not missing some detail because I ...
2
votes
3answers
519 views

Shell script to parse variable definitions from Scala build file

The build.sbt text file contains versions like this: name := "happy" scalaVersion := "2.11.8" sparkVersion := "2.2.0" I wrote ...
2
votes
1answer
92 views

Bash - Compile C++ File Function

As I am starting to be tired of reverse-searching in history for the C++ compile command, which I'm using - details on my flags are written here, I defined the following ...
6
votes
5answers
253 views

Convert FLAC files to MP3 in parallel on Ubuntu

I created a script to convert my FLAC music collection to MP3. I did this so that I can play the MP3 files in my car, as the integrated head unit only supports MP3 and WMA files. The script works on ...
3
votes
1answer
147 views

Bash script to extract wifi passwords from NetworkManager

This is my first shell script, so I am trying to see if I can get some suggestions. It extracts saved wifi passwords from Linux. ...