People who code: we want your input. Take the Survey

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
2answers
33 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 ...
6
votes
3answers
579 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) ...
4
votes
2answers
150 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 ...
2
votes
0answers
38 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 ...
0
votes
1answer
28 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 ...
1
vote
1answer
24 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(...
3
votes
1answer
53 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 ...
3
votes
3answers
50 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 ...
3
votes
1answer
40 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 ...
0
votes
1answer
20 views

Bash script syncronizing yaml and asciidoc headers using sed

I have a bash script that fixes or creates, and syncs the asciidoc attributes and yaml header for blog posts. It does what it is supposed to. But notice I have put ...
3
votes
2answers
97 views

Wrapper to mount partition before launching executable

Solved task is pretty straightforward: mounting partition if not mounted already, to start executable. There is a couple of checks and notifications because it is supposed to be launched from X and ...
0
votes
1answer
31 views

Watch for file changes in Linux

I have installed Geekworm x735 on my Raspberry Pi, it uses the script below with an infinite loop to determine if the power button has been pressed. I know there are some Linux utils that watch for ...
1
vote
1answer
32 views

Rdoc - a command-line tool for launching documents (improved)

A few days ago I posted a previous version of my first bash script here to get few tips and reviews so I could improve it. So now it is improved a bit. I also shellchecked it and fixed the warnings. I ...
2
votes
0answers
29 views

bash / awk workflow operating on multi-column files [closed]

I am working on the improvement of the bash-awk workflow designed for the analysis of data in multiple-colums format. The script uses AWK code (which extract numbers from selected columns of the input....
0
votes
1answer
79 views

Bash script that helps in opening documents when using terminal

I just finished creating my first bash script that helps me to launch documents from terminal using a pdf viewer. This is very helpful and fast (at least I think so) for people who don't use any files ...
1
vote
1answer
25 views

Bash script for mounting and backing up VeraCrypt volumes

My bash script mounts two VeraCrypt volumes, rsyncs their contents, and dismounts them. The script takes two parameters, the path for both the source and backup veracrypt volumes. I wrote this script ...
1
vote
0answers
16 views

Printing of status message during execution of the bash script

As a part of my bash routine I am printing some message in terminal regarding status of the workflow. The message in splited into two parts (part 1: begining of the task, part 2: status of its ...
0
votes
0answers
12 views

Short bash script to join arguments with dashoption, escaping quotes and $ dollar sign

So I got this short awk invocation wrapped in a bash script. unfortunately the bash script is kinda unreadable. Do you have any pointers? ...
2
votes
1answer
46 views

Bash: call make when directory changes

I usually like to use entr when developing on my own hardware to run commands when a directory changes. However, sometimes I'm working in an environment where I don'...
0
votes
0answers
36 views

Multiple async wait

I need a review and best practice approach to do something like that: ...
2
votes
1answer
26 views

Initialize a gitlab project both locally and remotely with a single command

This shell script, with only a few configurations, has the goal of initializing a project on Gitlab.com without having to go through the go through the website's ui. This means: Let's say you just a ...
3
votes
1answer
99 views

Bash Script for healthcheck linux

I have below bash script which i have written to check the health of different storage component and then creates an incident through service-now tool. This is script is working fine for me but i ...
0
votes
1answer
23 views

Small bash script to quickly edit scripts in $PATH

Staying true to the mantra: "The third time you do something, you automate", I've built up a decent collection of shell scripts that live in ~/bin. Some ...
0
votes
4answers
54 views

Linux bash script to ignore '$'

Many times I have copy and pasted from a guide that had the following instruction: $ echo "Execute xyz" and would get the error $: command not found So I created a bash script to ignore ...
0
votes
1answer
30 views

Generate a find command with pruned directories based on a config file

The idea is to perform indexing of filetrees while excluding certain directories. I want to give the user a simple conf file instead of having to edit the script itself. This is what I came up with: ...
0
votes
1answer
49 views

Tail program output to stdout or stderr

I have a piece of bash code that works fine. ...
3
votes
1answer
94 views

All core MediaWiki upgrade script (round 2)

The following script upgrades an existing, all core (no add ons) MediaWiki install. I run it with set -x for debugging (I avoid ...
0
votes
1answer
60 views

Dirty Bash hack to run the ssh connections in the Parallel mode

A Few years back I used to opt the below method to run the shell program in a Parallel way to open multiple ssh session at a time to get a quick result. I know there are various other good utilities ...
1
vote
0answers
15 views

Swap a symbolic link with its target

This program takes a symbolic link as argument, and swaps the link with its referent. For example, given a -> b, the result will be ...
5
votes
1answer
132 views

Simple log function in Bash

I am just getting a little more comfortable with Bash. I wanted a super simple log function to write to a file and output to the console for messages and errors. I also wanted the terminal and the ...
3
votes
1answer
28 views

Bash script for log rotation

Okay, first things first: Yes, I am aware of the logrotate tool, which would usually be used for something like this. However, since the logfile i want to rotate already contains a timestamp in the ...
2
votes
1answer
38 views

Bash - Automating creation of test files

I'm in the process of understanding shell scripting - this is my simple code for adding test files for python unittest I'm looking for best practice pointers, variable naming, and of course comments ...
9
votes
2answers
568 views

Daily stand-up list

Like most teams, we take turns to speak in our daily stand-ups. When we gather around the sprint board, it's easy to know who speaks when - we start at one end and pass the role along the line. At ...
4
votes
2answers
246 views

Script to unpack archives of various kinds

Just looking for some feedback and constructive criticism. This is the second script I ever made. Just recently started learning the basics. Anyway just wanted to post the script and see if maybe I ...
3
votes
1answer
46 views

Bash script to install zsh on different distributions

Extreme script newbie here, so please go easy on me! I wrote a script to install zsh on a number of different Linux distributions. But since I'm so new at this, I'm piecing a lot of different things ...
7
votes
2answers
158 views

Bash script - compile and run c++ code for coding competitions

This is a simple bash script that I use to compile and run single C++ files for coding competitions. Features: Detects if there is a corresponding .in file next to ...
1
vote
1answer
29 views

Updated bash/zsh function that cd to the root of git tree

here's the updated version of the code for being reviewed. Fixes: "private" _cg function functions definition as ...
1
vote
1answer
57 views

Bash script for an ABC organization fulfilling the following requirements

Write a bash script for an ABC organization fulfilling the following requirements: Takes an Employee's Name, designation, age, years of service and salary, extra working hours as an input. Calculates ...
4
votes
1answer
76 views

Bash/zsh function that cd to the root of git tree

I'd like to get a review for the function that cd into the git tree root or does nothing if we are outside of the repository. reviewed version: ...
11
votes
2answers
1k views

Wi-fi scheduler written in C

I'm new to C and programming in general (some minimal prior exposure to JS and python). This is also my first time working with shell commands, scripts, and cron. This program works on my macOS and ...
4
votes
0answers
240 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 ...
5
votes
1answer
47 views

How to put apt and python packages in a list and check if installed or not then install

I am not an expert in shell scripting, I need help optimizing the shell script I wrote, This shell script I wrote is run by users on the client side who connect to our vpn server from the setting ...
1
vote
0answers
32 views

replace ipset with bash script

So what I'm trying to do is to get "bad" ip's from this page https://raw.githubusercontent.com/stamparm/ipsum/master/ipsum.txt Then I made a script that replaces ipsets to block, by ...
0
votes
1answer
69 views

Compare script using awk and bash

I try to create compare script using awk and another command and running successful. But I think the script I create it's to long. Is there anyone can shorten my script below ? After plan A ...
3
votes
0answers
38 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. ...
8
votes
1answer
364 views

Compare all files to each other

I will start by saying I have gotten this to work, and the question is about how improve the script to make it better/faster. I need to compare a series of files to each other. Let's say I have the ...
5
votes
0answers
42 views

Utility to edit config files globally

I wrote a small utility in bash that allows me to edit config files anywhere. So, whenever I want to edit a config file, I don't have to type its full path or have to remember where it is. First, I ...
2
votes
0answers
59 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 ...
6
votes
1answer
102 views

binary data shell echo generator

edit: here is a cleaned-up version incorporating most (but not all) feedback, thanks guys; https://gist.github.com/divinity76/79efd7b8c0d7849b956cd194659c98e5 I need to... generate a linux shell ...
5
votes
1answer
50 views

First Bash script keep costs in check

A few days ago I wrote my first own Bash script - did some really small thing a few years ago - to keep my costs in check and get an overview over them. Therefore, I want it to include cost adding, ...

1
2 3 4 5
15