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.

70 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
136 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 ...
user avatar
  • 151
5 votes
0 answers
663 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 ...
user avatar
4 votes
0 answers
35 views

Shell script to backup local files to public cloud

This is a script that I've written for personal use, and to educate myself. The script is a bit comment heavy to help future me remember all the details & design choices made at the time of ...
user avatar
  • 141
4 votes
0 answers
382 views

Bash script for user backups with BorgBackup

I use BorgBackup to handle backups for my personal computer. The following is a bash script that creates backups of my system to various different targets. I have little experience with bash and hope ...
user avatar
  • 41
4 votes
0 answers
1k views

Copying multiple S3 files in parallel using aws shell command

Any improvements to this welcome, I have got it working and I'm happy with it. I'm not really all that proficient with bash shell scripts though. Problem: AWS can copy multiple files pretty much as ...
user avatar
  • 143
4 votes
0 answers
431 views

Clear-net browsing with Lynx over Tor

This project is designed to enable clear-net browsing over the Tor network with the Lynx web-browser. Currently everything seems to be functioning as intended, however, it would be most appreciated if ...
user avatar
  • 976
4 votes
0 answers
399 views

tar-backup V1.01 - backup script for Linux (full and differential backups)

The backup script itself. Make it executable and place it somewhere in your path: ...
user avatar
4 votes
0 answers
97 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 ...
user avatar
  • 143
4 votes
0 answers
254 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 "...
user avatar
4 votes
0 answers
166 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 ...
user avatar
4 votes
0 answers
59 views

Selective Time Machine backup deletion

Time Machine is a useful backup service for Mac, but deleting multiple backups is cumbersome. This script allows mass deletion of unwanted backups while allowing specified "important" backups to ...
user avatar
4 votes
0 answers
91 views

SLOC Counter Script Optimization

I'm a HPC guy so I'm all about "make it work, then make it fast." I have a little bash script which gets a Physical Source Lines Of Code (PSLOC) and Logical SLOC (currently just of Java code, but it ...
user avatar
  • 161
3 votes
0 answers
117 views

Bash script for pull-mode backups via restic's rest-server

I wrote the following Bash scripts to make pull-mode backups with restic, a backup solution written in Golang, similar to Borg Backup. The main use case for this script is pulling backups into a ...
user avatar
  • 323
3 votes
0 answers
50 views

Bash script for rebalancing weighted round robin

I have written a tool that is used to rebalance weights in a weighted round robin in AWS. I am quite happy with it whereas I would welcome feedback from any Bash programmers. ...
user avatar
3 votes
0 answers
62 views

Bash script to mirror XWindow to remote SSH host

The source code within this question aims to provide a short-cut for mirroring a local XWindow (or session) to a remote host via SSH port forwarding, such as: ...
user avatar
  • 976
3 votes
0 answers
74 views

Systemctl services start and UFW ports allow script

I made a script to start something akin to a "session" in which I start services and open tcp and udp ports in the firewall in order to work with, for example, a full stack project, and stop and close ...
user avatar
3 votes
0 answers
974 views

Using SSH.NET to interact with a Bash shell

I'm trying to interact with a bash shell on a router to automate some CLI commands using SSH.NET. I'm not sure if the approach I'm taking is the best one and would like to get some recommendations on ...
user avatar
  • 131
3 votes
0 answers
36 views

Merging multiple awk commands while retaining functionality

Turned in a project a few days ago, and I needed a way to filter and format values off a file. I decided to go for a bash script since it seemed like a good option, and I came up with the following: <...
user avatar
  • 31
3 votes
0 answers
33 views

NRPE script for monitoring filesystems usage

Next script returns NRPE friendly output. It checks percentage usage of all local filesystems. Desired output if everything is ok: OK | /=56;;;; /boot=20;;;; /opt=40;;;; /var=60;;;; (and ...
user avatar
3 votes
0 answers
167 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: ...
user avatar
3 votes
0 answers
33 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 ...
user avatar
3 votes
0 answers
27 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 ...
user avatar
  • 31
3 votes
0 answers
49 views

Bash manual page selection menu (version 2)

This is update to a previously asked question Bash manual page selection menu. This script generates a menu for the user to select which manual page he/she would like to read. ...
user avatar
  • 379
3 votes
0 answers
290 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 ...
user avatar
  • 61
3 votes
0 answers
73 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 ...
user avatar
2 votes
0 answers
47 views

Implementing a data extraction pipeline with Bash

I wrote the following scripts to extract data from BigQuery and InfluxDB using the bigquery cli and the influx cli. The code works as expected. I included all files for completeness, but I'm primarily ...
user avatar
2 votes
0 answers
39 views

Fast git change sets with git wrapping scripts

After having a good experience with virtualenvwrapper built on top of the venv, I thought maybe it could be benefitial to have similar shortcuts for standard activities with git which could be time ...
user avatar
  • 121
2 votes
0 answers
15 views

Reliable separation of Steam users

I wrote this bash script to try to make sure save games don't get mixed between different steam users using the same Ubuntu account. It uses inotify to try to figure out when a user changes and a soft ...
user avatar
  • 196
2 votes
0 answers
60 views

The Blacklist v2

This script gathers domains listed from sources in this JSON file and compiles them into one text file. Text files that have a similar key under the whitelists ...
user avatar
  • 2,897
2 votes
0 answers
154 views

Ansible to automate dev environment setup

This is a follow-up to Bash script to automate dev environment setup. In that question I'd thrown together a (sloppy) shell script to automatically setup my development environment. One of the answers ...
user avatar
  • 967
2 votes
0 answers
17 views

Pulling host list from ldapserach command from netgroup

As i am learning bash, i have written a small code which is nothing but a simple ldapsearch query which lists all the...
user avatar
  • 53
2 votes
0 answers
32 views

Upgrade script for MediaWiki website with one external addon (wave 2)

I have created the following Bash script to somewhat automate the upgrade of any MediaWiki website which contains one extension (ContactPage). I have tested the essential parts of the script several ...
user avatar
  • 21
2 votes
0 answers
36 views

What is a better practice in bash scripts to test if string is empty: [[ -z ${value//[0-9]/""} ]] or ! [[ ${value//[0-9]/""} ]]?

I test in a bash script if a variable value contains digits only. There are two options, both give the valid results: ...
user avatar
2 votes
0 answers
88 views

Bash wrapper for connmanctl with autocompletion

So the idea came from the fact that connmanctl only completes filenames/directories when used non-interactively, whereas when used interactively (executing ...
user avatar
  • 507
2 votes
0 answers
16 views

bash script to delete files resurrected by Adobe InDesign bug

After a March update, Adobe Indesign will resurrect removed directories it was responsible for creating in the first place, but not any files except for one file called "AdobeFnt.lst". So where once ...
user avatar
2 votes
0 answers
691 views

Qutebrowser Searchengine Script

Qutebrowser uses search engines similar to DuckDuckGo's Bangs to facilitate searching. The config.py file for the browser contains a search engine Python dictionary....
user avatar
2 votes
0 answers
53 views

Vim swap file sweep and recovery

This is the draft contents of a function intended to be run after a system crash in order to quickly review all of the recent vim swap files. They will be loaded up into and displayed in a vim ...
user avatar
  • 121
2 votes
0 answers
43 views

Outputting a standalone shell script from arguments

I am solving an exercise. Essentially, it's a shell script that takes in file and/or directory arguments and outputs another (standalone) shell script that outputs these files, including any directory ...
user avatar
2 votes
0 answers
35 views

Bash script to scp specific, most-recent files from remote server

I'm writing a helper script that I wish to be able to share with my co-workers. We all work using macOS Mojave, but all have their own shell configurations. For example, I actually use ZSH and bash 5....
user avatar
  • 225
2 votes
0 answers
19 views

Auto re-connecting to a VPN on OS X and pointing Squid accordingly

We need to tunnel certain applications over a VPN at work. Ideally we would use a dedicated firewall/network appliance for this but the only permanent infrastructure we have are Mac Pro's running ...
user avatar
2 votes
0 answers
98 views

Bash bitcoin blockchain explorer

I wrote a little bash script that displays the transaction info in json: ...
user avatar
2 votes
0 answers
42 views

Bulk File Rename; Improved Safety and Performance

A function that funnels all filenames into a file and opens that file in vim. The user then changes the names, saves, and quits. Finally the function renames the files in the folder with the new names ...
user avatar
2 votes
0 answers
621 views

BASH script to obfuscate android/meterpreter payloads

I have written a little script that does a pretty good job of obfuscating android/meterpreter payloads. It will generate payloads or used supplied msf payloads while also injecting a custom icon. The ...
user avatar
2 votes
0 answers
57 views

Code to backup the history file in Linux

How is the logic, efficiency and can it be improved? This is a snippet from my .bashrc file; I just wrote it and I've tested it and it almost works. This was the ...
user avatar
2 votes
0 answers
109 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 ...
user avatar
  • 91.6k
2 votes
0 answers
119 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 ...
user avatar
  • 121
2 votes
0 answers
90 views

Copy recently modified files from one directory to another

I am new to bash scripting. Could you please give a review of this code that copies recently modified files from one directory to another in bash? The main commands are in my ...
user avatar
  • 61
2 votes
0 answers
111 views

Chip-8 Emulator in Zsh

I've spent the last few weeks writing a Chip-8 emulator in zsh. It doesn't run in bash but the syntax is nearly identical. I have it on a GitHub repo here: https://github.com/hcorion/chipzsh a ...
user avatar
  • 21
2 votes
0 answers
158 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? ...
user avatar
  • 379
1 vote
0 answers
54 views

Is this docker entrypoint bash script for passing parameters to the containerized app 'good'?

Source code located here I am trying to pass extra parameters from a container to the contained application. The following bash script is working to pass extra variables, but I'm not sure that it's ...
user avatar
  • 111