Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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.

3
votes
1answer
37 views

Bash delete folder if not present in other folder

imaging a folder structure like: Peter |- Cats |- Mini |- Maunz |- Tippsi |– Dogs |- Brutus Eva |- animals |- Mini |- Brutus I'd like to ...
6
votes
2answers
64 views

Interactive bash script to create new permanent swapfiles

I started self-learning Bash scripting yesterday, and I finished my first successful "advance" script. Goal To create an interactive step-by-step script to that allowed customizing various parts of ...
2
votes
1answer
36 views

Making a disk usage breakdown

I'm looking for a better way of doing this code I made. I work for tech support and one of the biggest questions I am asked is: "Hey, how did my disk get so full in my VPS?" I am aiming for output ...
7
votes
1answer
177 views

Debian Firefox Quantum update script

I wrote a little script to automate upgrading Firefox to a new version under Debian, since I don't want to install it from unstable and the snap version has ...
3
votes
1answer
63 views

Bash script creator app

I am a beginner and have created this bash script that helps me with creating bash scripts. The script shows no issues on shellcheck.net The code can be found here. https://github.com/plutesci/...
2
votes
1answer
52 views

hangman in bash

Rules 7 mistakes allowed. Hangman rules. Disclaimer I don't have a figure (drawing) of the hangman as this project took way longer than I thought I would take. It took like 9 hours during 3 weeks. ...
3
votes
2answers
40 views
4
votes
2answers
48 views

Finding domain details with bash

Here is my code to find the details of the domain. The domain can be feed as following: ...
7
votes
2answers
59 views

Bash evaluation using crazy passwords

I have some code that is loading passwords from AWS SSM and then using them through the script. I am really concerned that some funky password character is going to be used that is going to get ...
1
vote
2answers
38 views

chmod all .htaccess files under all website dirs under public_html dir

This is my code to chmod all .htaccess files under all website dirs under public_html dir. The reason I use this code is to make sure WordPress plugins won't "...
3
votes
2answers
50 views

Bash script to rsync website

I'm new to bash scripting. I have pieced together a bash script to rsync my website files and databases. Any guidance on ways I could improve or make my script more secure would be greatly ...
6
votes
1answer
136 views

Updating my package version using only a Makefile

So I have written a Makefile that has a release function that can be run like: make release bump=patch and I want it to be fully ...
8
votes
1answer
125 views

A Simple Bash Timer

This is a timer I made quite some time ago and just came across it again today. I'm just wondering if there's anything wrong with it or anything I could improve. ...
7
votes
1answer
74 views

Squire for your recursive SSH adventures

One day I used to SSH to lots of machines to do some administrative tasks. I constantly used l to list directories just like I do on my own machines. Guess what, ...
7
votes
2answers
168 views

Copy files in parallel by reading what files to copy from few other files

I am working on a little complicated shell script for the first time and this is what it should do: During startup, it figures out what is my clientid by looking ...
3
votes
1answer
22 views

Creating charts for my UPS metrics - Part 2

Following up from my previous question Streaming my UPS metrics for graphical viewing in bash ...
4
votes
1answer
401 views

Bash script to replace string in database

How secure is my script? ...
3
votes
1answer
27 views

Streaming my UPS metrics for graphical viewing in bash

I have an APC UPS, which comes with the apcaccess utility to get various statistical values from the apcupsd daemon service. I ...
6
votes
1answer
64 views

Install Python script requirements

Sometimes I download a Python script (from a trusted source), and can't run it because of missing dependencies, which I have to install one by one (no ...
1
vote
0answers
25 views

Create an XML using the CSV input [closed]

Aim : To create a xml file from the csv file I am trying to create a xml file from the csv file , the xml contains header , footer and body . I have create 3 different functions. Input csv file <...
2
votes
2answers
37 views

Bash script to generate and change Java keystore passwords

This is the first Bash script I've written, so I'm looking for feedback on best practices, conventions, things like that. This script makes a few assumptions There is a java keystore stored at ...
2
votes
1answer
63 views

Dompdf LFI (Local File Inclusion)

Intro During a CTF I encountered a dompdf LFI vulnerability, which is explained at exploitdb. However when I executed that vulnerability it gave it to me in PDF form, and it was a pain to constantly ...
5
votes
0answers
40 views

Bash completion functions for pmount and pumount

I found a problem with Debian's Bash-completion for pmount and pumount, and intended to send a patch with the bug report - but I ...
8
votes
2answers
140 views

Identify users who have logged in as root

This is a program written in Python 3.x and Bash to check and find any users who have logged in as root via sudo su, sudo -i, ...
3
votes
2answers
59 views

Moving files and leaving links in bash

The objective of this code is to create a command that move files and leaves links in their place. I'm just a beginner in shell scripting and it would be quite useful to hear your opinions on how to ...
4
votes
1answer
31 views

throwcatch: Super easy, SFTP-based backup tool

I've been working on a project for fun, it has reached a place of pretty decent stability and I would like to hear any and all criticisms you can find. The project basically enables admins to create ...
2
votes
1answer
46 views

Small bash script to enhance virtual environments on directory navigation

Ages ago I made a small bash script which would add a command cdp, standing for "change directory - project". What it did was ...
4
votes
0answers
62 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
23 views

Finding (and counting) duplicate JS/Java files

I have the following script which takes minutes to give output. ...
4
votes
3answers
57 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
51 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
39 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
294 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
196 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
86 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
39 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
67 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
36 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
40 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
28 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
74 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
66 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
46 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
66 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
65 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
39 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
50 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
29 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
16 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 ...