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
1
vote
0answers
77 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
57 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
105 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 ...
3
votes
1answer
108 views

cron daily and weekly scripts for a minimal Nginx server environment

I've created the following 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
232 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 "...
5
votes
2answers
76 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
71 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
29 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 ...
2
votes
1answer
152 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 ...
4
votes
1answer
79 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
145 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
472 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
63 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
94 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 ...
5
votes
1answer
87 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
1k 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
366 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
89 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
127 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 ...
3
votes
1answer
838 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
821 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
689 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
96 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
322 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
181 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. ...
1
vote
1answer
56 views

Verify that a CSV file contains a backup job for every prod job

This is a list of jobs in autosys. What I have to do is make sure that every job in PROD has a accompanying job in BACKUP. The jobs are formatted as ...
3
votes
1answer
62 views

Don't MiTM me please

To first understand how MiTM works I've made a few MiTM scripts, but this time I wanted to defend myself against such attacks. I'm unsure if my idea even works. The code seems to be working but I make ...
3
votes
1answer
177 views

Passphrase generator script

Below script is used to generate passphrases for gpg (or anything really). Do you see any blatant security mistakes in it? I wrote it by myself, because I couldn't find any passphrase generator that ...
3
votes
0answers
22 views

Compare timestamps of svgs versus exported pngs and export via Inkscape

This script goes through all svg files in an assets folder and compares them to the exported layers (one level above). If the svg timestamp is newer, it will automatically export the svg using ...
1
vote
2answers
57 views

BASH correct usage of single/double quotes when writing variables to file

(running Ubuntu 16.04.3) I created small script with tasks I do every time I upgrade/change Ubuntu version. One of the tasks is to write script to file, this is actual written file: ...
4
votes
0answers
145 views

Bash script to symlink configuration files from git repo into home directory

My goals are to: Do it automatically (without adding a line to my script every time I add or change the location of a config file) The files in the git repo folder should not be hidden, but the ...
2
votes
0answers
112 views

Read file real time with while loop and trigger action on change

I want to read a file real time with a while loop that is being fed by the stdout of a process (inotifywait). The output could ...
2
votes
1answer
99 views

Extracting large tar.bz2 folders in parallel

The bash below utilizes parallel to extract tar.bz2 folders with 9 files in them. The total size of each is around 60GB. Below ...
3
votes
2answers
140 views

Authenticating to Amazon EC2 Container Registry

New to bash. The script I wrote works, but I don't believe it is written in the best way possible. The script only assesses how to execute the aws ecr get-login ...
2
votes
2answers
46 views

bash input parameter logic

The following works fine and I'm not having to repeat any commands once logic is evaluated. However, it feels as though I'm doing a lot of seperate checks. I'm wondering if I could do this more ...
1
vote
1answer
53 views

Bash time converter

This is a simple script to convert a given unit of time to other units of time. I wrote this mainly to practice writing scripts that incorporate positional parameters. It actually turned out better ...
2
votes
1answer
128 views

Batch bash installer script for clean Ubuntu GNOME installation

I just finished (I think) writing a bash script to install all my essential software to Ubuntu GNOME. I'll be making more for different distributions but once I have one to go off of, I can do the ...
3
votes
1answer
38 views

Bash functions to modify PATH

I am working on improving my bash environment. I have added the following function to my ~/.bashrc in order to facilitate modifying my PATH as well as removing ...
12
votes
2answers
3k views

Bob Marley is jamming on the wifi

Bob is jamming it's way through the city deauthenticating people from thier wifi for a few seconds. First scanning all possible wifi-AP and then pretty printing them, afterwards you can choose a wifi ...
4
votes
1answer
28 views

Alternative to env that accepts arguments

It is commonly known that env does not allow passing of arguments - at least not reliably. There are various workarounds described here, but they felt to hacky and ...
8
votes
3answers
1k views

Bash: change git remote from SSH to HTTPS within a given dir

The code takes a user input dir path, then looks for git remote url that is still using SSH, and the repo is belong to an fixed Organisation. Then it will convert these repos' git remote url from SSH ...
4
votes
2answers
109 views

Sign an EC2/S3 URL Version 3

From the previous 2 versions: Sign an EC2/S3 URL Version 2 I fixed the comments from the previous version. Most of the code remains the same (so I have split out the new code for review). The main ...
2
votes
1answer
60 views

Sign an EC2/S3 URL Version 2

Follow up on previous review: Sign an EC2/S3 URL I have fixed the previous comments. I have also added the code needed to sign HTTP header fields as part of the request. ...
4
votes
2answers
183 views

Sign an EC2/S3 URL

The other day I found myself trying to walk through the instructions for signing an S3 URL. http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html Not as trivial as the ...
3
votes
2answers
73 views

Enable or disable sections of a model according to user input

I am using sed command to comment in or out sections in my model according to user input (commenting is done by prefixing the line with !). Once this is done, I ...
8
votes
3answers
490 views

PS1 for Bash prompt showing last exit status, written mostly in Python

I had most of this functionality accomplished in BASH, but I was having trouble getting the last process's return value (even though I had a minimal working example). Plus, the escape codes made ...
4
votes
1answer
44 views

Remove every line that include and follows the second occurrence of a given pattern

From a file, I am trying to remove every line that include and follows the second occurrence of a given pattern in Bash (Mac OSX). Note, that a file may have only one match of the given pattern (and ...
4
votes
1answer
59 views

Gentoo ebuild for CUPS to support Kyocera 1x2x MFP printers

Let me be the first one to post a Gentoo ebuild for review, as suggested by this meta post answer and comments. See also the corresponding issue on Gentoo Bugzilla. The ebuild installs proprietary ...

1
3 4
5
6 7
14