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
2 votes
1 answer
36 views

bash script to setup a digitalocean webserver (apache2, nginx, PHP7.4, fastcgi, SSL)

The following bash script is intended to be run on a freshly installed digitaloceans ubuntu 20.04 droplet by root in its home dir. The purpose is to setup a ready to use webserver with SSL (certbot), ...
user avatar
9 votes
4 answers
2k views

Git Push Bash script

I created this bash script to make it easy to publish your files to a GitHub repository. ...
user avatar
4 votes
1 answer
22 views

Download Ubuntu daily ISOs and make them into VMs for alpha and beta testing

I'm an Ubuntu contributor, and I finally got tired of the workflow for ISO testing I was using (zsync, gpg, sha256sum, create Gnome Boxes VM, install, delete VM). So I decided to make a Bash script to ...
user avatar
3 votes
2 answers
453 views

Implementation of the "tee" utility program

How can I optimize the program? To make it more optimal? The program should be more optimal in terms of source code, compiled executable size, memory usage, speed, bugs etc. Please criticize the ...
user avatar
  • 199
2 votes
1 answer
31 views

Strive to ultimate bash argument parsing

I've tried my best to write argument parser to cover all my needs and I won't need to edit the body of parsing loop, never again(:)) to add/remove parsable flags. The resulting code seem to cover's my ...
user avatar
  • 121
1 vote
1 answer
30 views

Change query strings with a Bash script

The following script changes start and end dates of several queries saved as files in the folder /app/queries. It is used by executing the script and passing two ...
user avatar
0 votes
1 answer
21 views

Execute several queries and save them to files in Bash

I wrote the following bash script to run queries saved in files and save them to csv files. The queries have to be run against a BigQuery database. I use the bq-cli ...
user avatar
2 votes
0 answers
49 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
4 votes
2 answers
107 views

ds - directory switcher - a *nix command line utility for tagging the directories and switching between them via tags (Perl + bash)

I have this program for tagging directories and switching between the folders via tags. The front end is written in Bash (version 4.4.23) and the back end in Perl (5.26.1). Critique request Since this ...
user avatar
  • 25.8k
4 votes
2 answers
351 views

Bash-based Port scanner (/dev/tcp)

This question is ideal in my case: Ludisposed's python-scapy-tcp-port-scan-of-subnet - At codereview stackexchange But this is not Scapy; nor Python(it might get used in the future though but that is ...
user avatar
1 vote
2 answers
19 views

Retrieve Logs from Multiple Containers on Remote Server

Recently I had the requirement to allow multiple containers of the same application to be run on a single development server. This requirement drastically changed how we retrieve logs over SSH from ...
user avatar
4 votes
1 answer
64 views

Shell script to download Project Euler problems and combine to PDF

This is a script I created that downloads Project Euler webpages and combines them to PDF. The script also downloads animated files. ...
user avatar
  • 818
4 votes
1 answer
48 views

Recursively Copy Dotfiles from Git Repo to New System's Home Directory

I manage my dotfiles in a github repo. The idea would be that I could clone the repo if I ever have to develop on a new system and symlink them to the home ...
user avatar
3 votes
1 answer
74 views

Bash script to clone directory structure with renaming

I've written a script to aid in creating new watchfaces for the awesome AsteroidOS project. A watchface there typically consists of directory structure like this: ...
user avatar
  • 64.4k
0 votes
1 answer
40 views

Bash script for creating a list with largest files

I started scripting a 2 weeks ago and wrote a script which checks every sub directory until a certain level for the largest files. My question would be if I'm using the getopts correctly and/or if I ...
user avatar
  • 1
1 vote
1 answer
90 views

Parse a selection of date formats

This Bash program parses day, month, year and month and year from arguments: ...
user avatar
  • 173
0 votes
1 answer
57 views

Bash script to process Kafka messages

I want to use shell scripts to consume kafka messages and return to status. I found that my script wasn't efficient enough. Can I write this script better? I want to output kafka-console-consumer.sh ...
user avatar
  • 9
5 votes
1 answer
43 views

Librarian script to find and copy a file

I wrote this script partly as an exercise in learning Bash and partly because I needed a tool to find specific versions of library files and copy them to a particular device. The script takes ...
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
0 votes
1 answer
31 views

bash loop for checking service and network connection

I want to start omxplayer, check if there is the process is up, check if there is internet connection start with play a streaming, if there is not play a local loop, meanwhile try to check if the ...
user avatar
  • 63
3 votes
1 answer
30 views

Bash argument parser with support for concatenated flags and '=' or ' ' between arguments and values

This is my best attempt so far at a bash script argument parser written without GNU getopt or bash getopts the first two ...
user avatar
  • 161
2 votes
2 answers
52 views

Bash function to create a directory and change to it in a single command

I find myself frequently needing to create a new directory and changing to it enough to want to combine the two commands, so I figured it was a good opportunity to practice scripting with bash. The ...
user avatar
3 votes
0 answers
121 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
4 votes
1 answer
29 views

Ease process for gathering metadata from PDF, DJVU, EBOOK files

Learning Bash using hunt and peck method. Following code was put together from results of many "How do I ..." searches. Thus styling may be inconsistent. See code for my motivation. Any ...
user avatar
1 vote
2 answers
50 views

Colour message prettifier in Bash

Features: messages formatted with clear borders errors sent to stderr colour handling colours can be included in other strings echoed to the screen without having ...
user avatar
  • 229
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
1 answer
43 views

bash function to "wrap" 7z

It appears that 7z can't write to a pipe, so I wrote the following bash function to emulate this functionality. I know this is a simple problem, but this is my first bash function and I feel like it's ...
user avatar
  • 751
1 vote
2 answers
49 views

ds4mac - directory switcher for macOS/Linux: the installer script

In this post, I present the bash script for installing the ds4mac: ...
user avatar
  • 25.8k
0 votes
0 answers
23 views

ds4mac - directory switcher for macOS/Linux: the script

I have this program in GitHub. It is used for switching to directories via custom tags. Here is the main bash script: ...
user avatar
  • 25.8k
2 votes
2 answers
37 views

bash script to collect new network sockets in a given period of time

The following bash code is meant to check every second the amount of NEW (relative to the last second) network socket files. at the end of the run it summarizes every 60 entries (should be 60 seconds) ...
user avatar
4 votes
3 answers
63 views

Get popular Arch packages

Get a list of popular Arch Linux packages with a popularity greater or equal than the given one. It asks for the popularity if it isn't given. Then gets the total number of packages and iterates until ...
user avatar
0 votes
1 answer
58 views

Uncompress files, with autodetection of algorithm

Hi Everyone, this is my first bash script ever. I would really appreciate it if you could provide me with some comments and insights regarding correct function use, logic implementation, and a lead to ...
user avatar
  • 1
0 votes
1 answer
29 views

Handling field separator option

Have been constructing an array that can be used to populate options to find. ${incl[@]} made from function parameter arguments that takes filename suffixes. ...
user avatar
  • 111
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
0 votes
0 answers
23 views

Bash function with dry-run and exec options

Am writing a bash function to run rsync, with possibility of using --dry-run option and ...
user avatar
  • 111
3 votes
1 answer
106 views

Compiling and running a program to generate fractal images

I'm making images. My steps are: create PGM files using a C program convert/resize PGM to PNG using Image Magic remove (big) PGM files To do it I use Make and a Bash script. The Makefile is very ...
user avatar
  • 175
1 vote
0 answers
55 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
4 votes
1 answer
56 views

Extracting domains and IPs from Exodus trackers JSON report

The following command series is used to gather every bit of valuable information from Exodus trackers. The ultimate goal would be to get this all into one jq ...
user avatar
  • 2,897
3 votes
2 answers
34 views

Test harness that uses server process

I have a test suite that queries a localhost-based server. The server process needs to be running in order for the server to work. The process may be running already for debugging work, but it might ...
user avatar
5 votes
2 answers
372 views

Bash partitioning script

What can I improve in this script? Do I read user's yes/no answers by right way? Should I write bash scripts so that to be compatible with POSIX? ...
user avatar
4 votes
1 answer
138 views

Generating a domain and IP blacklist with Bash

This is a project to pull domain & IP blacklists from various sources and compile them into one list. There are some whitelists included that are applied when a blacklist is built. It draws ...
user avatar
  • 2,897
1 vote
2 answers
64 views

Installing packages if they don't exist in Bash

This script simply installs the chosen packages if they're not present on a Linux system using the apt package manager. Notes on improvements of any aspect are ...
user avatar
  • 2,897
6 votes
3 answers
699 views

Updating text in a HTML document with Bash

This is a small script to update my project's README file. Notes on improvements from any aspect are welcome! Here is the document it updates. readme.sh (Executed like so: ./readme.sh) ...
user avatar
  • 2,897
4 votes
2 answers
207 views

Linux backup script written in bash for tar

This is my first attempt at scripting with bash. I am running Ubuntu server, so I don't get to use all the gui back ups out there. Besides, tar works fine for personal use. Please let me know of any ...
user avatar
  • 195
2 votes
0 answers
61 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
1 vote
2 answers
143 views

Bash script (to be used as a login MOTD message) that displays status of docker-compose projects, and individual docker containers

This is for a cheap VPS I use for personal projects. I like having a message of the day displaying system info on login; I wanted to add the status of my docker containers to it, to see if all are ...
user avatar
  • 371
1 vote
1 answer
32 views

Testable and self-contained bash script

I wrote a short bash script for a completion check of downloading images. goal of this code (Added) I have some downloading content directories. Each of them has a script for downloading images(...
user avatar
3 votes
1 answer
68 views

Parse log file and send the result to an API

The task is to get the most recent login time of the day for each user. Then send such a result to an API. The log file (file.log) looks like the following (only ...
user avatar
  • 5,487
3 votes
3 answers
480 views

Bash script using rsync to backup (another one)

I created a backup script in bash to basically backup my webservers using cron commands. The script reads one or multiple config file(s), downloads a target directory, and can send by mail the rsync ...
user avatar
  • 151
3 votes
1 answer
75 views

The Blacklist: Blocking Malicious domains using Bash

I've made this script to automate blocking some deviant hosts on my router, and was curious if there's anything much else that can be done to make it quicker and more efficient. Presently I'm ...
user avatar
  • 2,897

1
2 3 4 5
16