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

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.

2
votes
0answers
14 views

Serial copying from disk images to folder in Bash

This is a Bash script that copies files stored inside disk images to a directory, using a defined structure provided via a JSON file. I've included the external programs it requires and the test I ...
3
votes
2answers
54 views

Code to get the IP address and format it to run in nmap

For scanning my subnet using my IP address, I need to run the following command nmap -sn 192.168.100.* I want to extend this functionality such that I don't have ...
2
votes
0answers
13 views

BASH Script to Configure Monitors on Linux via xRandR

My main computer is a laptop which I run i3wm atop Arch Linux. As such, my monitor situation sometimes changes, so I wanted to code a script to configure my monitors based on which ones are connected ...
1
vote
2answers
15 views

Bad performance bash, changing display brightness

I have a script that changes the display brightness using xrandr. It is my first bash script. I mainly had a lot of trouble with dealing with the floating point ...
2
votes
1answer
40 views

Simple bash argument parser

In a bash script, I need to parse arguments that have the following form: The main arguments can be thought of as being a single argument, but I do not want to force users to quote the entire thing, ...
-3
votes
1answer
24 views

Using 'else' strategically when not needed [closed]

Is it a bad idea to include else's when not needed to make the logic more clear ? I've done this more with PHP with longer drawn out if/else's but if you look at the following code (bash) you can get ...
4
votes
1answer
29 views

Iterate over files and convert with a new name / directory

I'm pretty new to bash scripting. I want a script that I can run in a directory that contains .md files, runs pandoc on them, and delivers the output to a sibling ...
2
votes
1answer
40 views

Partial Maven clean install after Git pull

I had searched for a solution to mvn clean install on my changed projects after a git pull. I even asked a question over at SO ...
1
vote
1answer
82 views

SSMTP configuration in Ubuntu 18.04 with Bash in my own system (one user)

This is how I configure the utility SSMTP that allows me to send mail via smtp protocol through a Google-Gmail proxy instead I'll have to manually configure an "...
3
votes
1answer
29 views

Script to clean up old files that should only run one instance

I'm writing a bash script for deleting old files on a Linux server. Here are some relevant facts about this script: As currently written, it does work as expected. However, it's entirely possible ...
1
vote
0answers
30 views

Elastic Beanstalk configuration using ebextensions container_commands combining leader_only and test

For our Django app running on AWS Elastic Beanstalk, we use a web-server/worker setup. The same code is deployed to the web-server and worker environments, and environment-specific configuration is ...
3
votes
1answer
45 views

Bash program that sets up and configures the environment for new Debian installs

Here is my second version of a bash program I'm writing, as per @hjpotter92 I've updated and cleaned it since last: This script is run directly after a fresh install of Debian, to do: sets up ...
4
votes
2answers
47 views

CGI for htpasswd registration

I decided to go with a very simple CGI user registration program to pair with Apache's mod_auth_form wrapper around a private site. It was only just after I ...
3
votes
2answers
39 views

Check that file is fully downloaded by FTP

I have a task in which I want to handle error occurred in FTP downloading, For which I used the wget command to download a file via FTP and once the download is ...
2
votes
2answers
114 views

Bash script to change network interface parameters/configuration and start virtual machines

On my Arch Linux system I have created a script that should do the following on system startup: detect all network interfaces check if physical interfaces are up check if bridge interfaces are up ...
2
votes
1answer
24 views

Ubuntu kernel update and removal automation script

This is my first bigger than a few lines bash script. It automates kernel updating and removing on Ubuntu through ukuu (Ubuntu kernel update utility). I'm not yet ...
6
votes
1answer
65 views

Bash script to send notifications when low on ram

Backstory Recently, we've changed the PCs at my workplace to un Linux Mint. It works amazing, is blazing fast and the adjustment time was very short. However, I noticed my PC would freeze completely,...
4
votes
1answer
30 views

Small script to verify hash of a downloaded file

You know how whenever you download a file you should really compare the hash of the download to the one provided on the website? This makes absolute sense, but it's a pain to do it letter for letter, ...
5
votes
1answer
101 views

Bash script to setup new Debian installs

This script is run directly after a fresh install of Debian, to do: sets up syntax highlighting in nano, sets up iptables, sets ...
2
votes
1answer
39 views

File generator in shell script

I'm a student, and most of my lab work includes writing programs (usually .cpp) run them, copy the source code and output to a word file and either mail a pdf to the concerned teacher or submit in ...
6
votes
2answers
148 views

A baby monitor using a Raspberry Pi to send push notifications when triggered by noise

I have a Raspberry Pi 3B with a USB microphone. I have used a combination of Bash and Python scripts to detect noise levels above a certain threshold that trigger a notification on my phone. The ...
2
votes
1answer
41 views

User-friendly script for searching through log files

A BASH script that ask users simple questions and greps the syslog archive files (plain-text and gzipped). The script is fully working; I am looking for advices on: Coding style Possible ...
3
votes
1answer
38 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
70 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
41 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
197 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
325 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
70 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
54 views
4
votes
2answers
53 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
65 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
160 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
133 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
77 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
169 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
26 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
417 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
67 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
27 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
63 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
82 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
57 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
149 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
62 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 ...