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
1answer
52 views

Verify that a CSV file contains a backup job for every prod job

This is a list of jobs in autosys. What I have to do is make sure that every job in PROD has a accompanying job in BACKUP. The jobs are formatted as ...
3
votes
1answer
60 views

Don't MiTM me please

To first understand how MiTM works I've made a few MiTM scripts, but this time I wanted to defend myself against such attacks. I'm unsure if my idea even works. The code seems to be working but I make ...
3
votes
1answer
155 views

Passphrase generator script

Below script is used to generate passphrases for gpg (or anything really). Do you see any blatant security mistakes in it? I wrote it by myself, because I couldn't find any passphrase generator that ...
3
votes
0answers
21 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 ...
1
vote
2answers
51 views

BASH correct usage of single/double quotes when writing variables to file

(running Ubuntu 16.04.3) I created small script with tasks I do every time I upgrade/change Ubuntu version. One of the tasks is to write script to file, this is actual written file: ...
4
votes
0answers
123 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 ...
2
votes
0answers
108 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 ...
2
votes
1answer
76 views

Extracting large tar.bz2 folders in parallel

The bash below utilizes parallel to extract tar.bz2 folders with 9 files in them. The total size of each is around 60GB. Below ...
3
votes
2answers
101 views

Authenticating to Amazon EC2 Container Registry

New to bash. The script I wrote works, but I don't believe it is written in the best way possible. The script only assesses how to execute the aws ecr get-login ...
2
votes
2answers
44 views

bash input parameter logic

The following works fine and I'm not having to repeat any commands once logic is evaluated. However, it feels as though I'm doing a lot of seperate checks. I'm wondering if I could do this more ...
1
vote
1answer
49 views

Bash time converter

This is a simple script to convert a given unit of time to other units of time. I wrote this mainly to practice writing scripts that incorporate positional parameters. It actually turned out better ...
2
votes
1answer
121 views

Batch bash installer script for clean Ubuntu GNOME installation

I just finished (I think) writing a bash script to install all my essential software to Ubuntu GNOME. I'll be making more for different distributions but once I have one to go off of, I can do the ...
3
votes
1answer
36 views

Bash functions to modify PATH

I am working on improving my bash environment. I have added the following function to my ~/.bashrc in order to facilitate modifying my PATH as well as removing ...
12
votes
2answers
3k views

Bob Marley is jamming on the wifi

Bob is jamming it's way through the city deauthenticating people from thier wifi for a few seconds. First scanning all possible wifi-AP and then pretty printing them, afterwards you can choose a wifi ...
4
votes
1answer
28 views

Alternative to env that accepts arguments

It is commonly known that env does not allow passing of arguments - at least not reliably. There are various workarounds described here, but they felt to hacky and ...
8
votes
3answers
975 views

Bash: change git remote from SSH to HTTPS within a given dir

The code takes a user input dir path, then looks for git remote url that is still using SSH, and the repo is belong to an fixed Organisation. Then it will convert these repos' git remote url from SSH ...
4
votes
2answers
101 views

Sign an EC2/S3 URL Version 3

From the previous 2 versions: Sign an EC2/S3 URL Version 2 I fixed the comments from the previous version. Most of the code remains the same (so I have split out the new code for review). The main ...
2
votes
1answer
59 views

Sign an EC2/S3 URL Version 2

Follow up on previous review: Sign an EC2/S3 URL I have fixed the previous comments. I have also added the code needed to sign HTTP header fields as part of the request. ...
4
votes
2answers
161 views

Sign an EC2/S3 URL

The other day I found myself trying to walk through the instructions for signing an S3 URL. http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html Not as trivial as the ...
3
votes
2answers
72 views

Enable or disable sections of a model according to user input

I am using sed command to comment in or out sections in my model according to user input (commenting is done by prefixing the line with !). Once this is done, I ...
8
votes
3answers
406 views

PS1 for Bash prompt showing last exit status, written mostly in Python

I had most of this functionality accomplished in BASH, but I was having trouble getting the last process's return value (even though I had a minimal working example). Plus, the escape codes made ...
4
votes
1answer
41 views

Remove every line that include and follows the second occurrence of a given pattern

From a file, I am trying to remove every line that include and follows the second occurrence of a given pattern in Bash (Mac OSX). Note, that a file may have only one match of the given pattern (and ...
4
votes
1answer
54 views

Gentoo ebuild for CUPS to support Kyocera 1x2x MFP printers

Let me be the first one to post a Gentoo ebuild for review, as suggested by this meta post answer and comments. See also the corresponding issue on Gentoo Bugzilla. The ebuild installs proprietary ...
5
votes
1answer
825 views

Bash script for referencing git status output files

Whenever I do git status, I want to reference the files that were shown easily... whether it be so I can open it in vim, git add it, delete it, git checkout (to ...
3
votes
1answer
505 views

Bash script to deploy a mongodb cluster on local machine

I recently wrote a small script to deploy a mongodb cluster on a single machine. The cluster is composed of : 3 configurations server that holds the same informations (they are replicas ) 2 shard ...
2
votes
1answer
211 views

Bash - script to encrypt pdf files using pdfencrypt

I wrote a small script to get around the issue when using pdfencrypt on the command line the password is always echoed as well as being saved to the 'history'. <...
2
votes
1answer
106 views

Basic Nginx server environment creation script

Here's a script I wrote for raising up a basic Nginx server environment. The script includes an internal script named csb (create Sblock) which is used to create Sblocks in a comfortable way. As I'm ...
2
votes
1answer
50 views

Generates a bare git repo from existing one and copy it to a central server

This is a Bash script that takes the name of a local Git repo and a remote server host/path, generates a bare repo, and copies the bare repo to a Git server located in another server. Example usage: ...
3
votes
1answer
172 views

Loop for input section of rename script

For the input section of a script, I wrote a snippet using a while loop and an if statement to check whether there are matches ...
8
votes
3answers
388 views

Update MediaWiki settings with dynamic IP address

I'm running a MediaWiki instance from a home server where the public IP address is not guaranteed to remain static. The following script is meant to run at boot time to check if the IP address has ...
4
votes
1answer
119 views

Bash Script - batch rename files in current directory with preview

I have written the following script to automate my frequent usage of rename. This saves me from always typing the whole command to the command line as well as doing ...
9
votes
2answers
1k views

Memoizing or caching Bash function results

Update: I've implemented several of the features suggested below and packaged the improved code into a dedicated project: bash-cache . I display a number of expensive operations in my Bash prompt (e....
3
votes
3answers
85 views

Shell script to rebuild a Java webapp

I am asking for an experienced person to review my basic shell script. I do not write them at work, but I am a software developer. I am using this for my personal project that I am working on. Later, ...
7
votes
3answers
2k views

Getting the current IP from the command line

I made a tiny little bash script, that prints the current IP Address to the command line. I checked the script with ShellCheck (0.4.6-1) on a local debian install and I get the following message: ...
1
vote
2answers
119 views

Dockerfile for Laravel deployment

I'm looking for reviews about my first dockfile. I don't want to develop bad habits. The purpose is to quickly deploy my Laravel (5.4) application. I'm going to connect it with others database ...
18
votes
4answers
1k views

Discover random web servers and print the index page title

Github repo I wrote this little toy today that probes random web servers and prints out the title of their index page. I'm curious if this code is any good since I'm a bit rusty. get_titles.py <...
0
votes
1answer
68 views

Bash grep taking 3 days to finish. Any suggestions to enhance it?

I have a script like this that I would like to seek some suggestions on enhancing it. ...
5
votes
2answers
52 views

Install, configure, and maintain content for Ubuntu webserver

I made a script for my Ubuntu server(s) running on Google Cloud Platform. The idea behind it is I can create a new instance and paste this script in Google Cloud so it runs it on the new instance and ...
2
votes
1answer
78 views

Make cd command work with spaces

Some archives contain folders with spaces in their name. Sometimes while I'm browsing these folders, I want to open a terminal in current position, so I copy the path to paste it after a ...
4
votes
1answer
66 views

Automatic creation of python conda packages

I packaged a pure python library using conda. It is tested to work with 2.7, 3.5 and 3.6 and should work on all three mayor operating systems. I am quite surprised, that there is no command or ...
2
votes
2answers
35 views

Tag specific Git commits based on commit message contents

I am using GNU Bash 4.3, and Git 2.1.4, to tag certain git commits based on their commit messages. Specifically, I want to tag: as v0.0.1 the commit with message "...
4
votes
3answers
220 views

Completed Makeshift Bash & Makefile To Compile C++ Examples

I am just experimenting with Bash and Makefiles to make my life easier, and here's what I came up with. Scenario: Files are in a directory containing a tutorial, or an iteration. For example, one ...
3
votes
1answer
122 views

CSV Splitter in Bash

I am splitting a csv file where the first 3 columns will be common for all the output files. input file: ...
1
vote
2answers
275 views

Create individual files via Bash with MD5 hashes of all files in a directory recursively

I have an archive of photos stored in a directory tree on my Mac like: ./2016/05/17/photo-312.jpg ./2016/05/19/photo-1234.jpg ./2016/05/19/photo-5678.jpg I want ...
8
votes
1answer
80 views

Spoofs MAC Address to manufacturer of user's choice, Linux or MacOS

I've made a BASh script for Linux/MacOS that allows you to search for a MAC manufacturer and then generates a MAC address from that company and then spoofs it to that using ...
4
votes
2answers
463 views

Bash script which downloads the latest linux stable kernel

I made this script when I started downloading the latest stable linux kernel's source from https://www.kernel.org to compile it myself, now I have improved it a bit and decided to create a public repo ...
3
votes
2answers
32 views

Log Retrieval Script

I wrote a simple script to retrieve the logs from my website, and place them in a subdirectory called logs. It fetches the logs using sftp. I would like help with ...
8
votes
3answers
136 views

Bash script to batch rename files

This is my homebrew bash script for batch renaming files extensions (my music library needs organizing): ...
2
votes
1answer
401 views

Bash script that searches for directories with files called package.json and install dependencies

I'm relatively familiar with the command line, but I've usually reached for other languages rather than bash for more full on scripts. It works, but I'm wondering if anything isn't really idiomatic. I'...
2
votes
1answer
602 views

Start, stop and restart script for a MongoDB server

I have created an start, stop, restart script for a unix-mongodb-server. It would be nice if you could look over my code and give me some helpful hints on what I could change. I tested the script ...