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
137 views

Checking the status of a ZFS pool

I'd like to see if there are any suggestions on how to improve a simple conditional test at the beginning of a backup script that verifies a ZFS volume is "online" and has the name "tank". For ...
1
vote
1answer
48 views

Script to execute arbitrary command on each Git project in a directory

The idea is simple, most people have some one directory containing all their projects as subdirectories. When you are in the top directory and you run this script like so ...
1
vote
1answer
34 views

Print first element of the last line of files when the second element does not match a pattern

I am relatively new to Bash, regular expression and stuff. In a directory, I need to read the last line of all the files that contain the word "fitness", and list (on one line and separated with ...
1
vote
1answer
45 views

Alert on partition growth [closed]

I have a script that alerts me via email when a partition grows past a defined threshold in one hour. My script is run from cron hourly. Everything seems fine for 99% of the time, but occasionally I ...
1
vote
1answer
29 views

Backing up a server

I wrote a bash script to automatically backup a server and upload it to a server level FTP server. I'm somewhat new to the making of crontasks and other stuff heavily related to Linux administration. ...
1
vote
1answer
229 views

Screen timeout/lock script

This is a script I made while having trouble with xautolock and dimming of the screen right before locking it. I would like some tips for making it a bit more robust and to know of any disadvantages ...
1
vote
1answer
96 views

Simple Bash backup script - follow-up

As a follow up to a previous question, linked here, I have revised the code and developed what I believe to be a better solution. In summary, the script should backup all files in a particular ...
1
vote
1answer
352 views

Spell check interview problem in Bash

Thanks for taking the time to read this. I submitted a code screening for a company I really wanted to work for and spent a decent amount of time on their programming assignment. Pretty bummed when ...
1
vote
1answer
1k views

SpamAssassin spam analyzer script in PHP based on sa-learn command

I wrote a small script to analyse spam messages that are spam false negative; meaning that they are spam messages in nature but that happened to be in your INBOX folder because your spam filter failed ...
1
vote
1answer
193 views

Parsing of a file using sed

I have a file containing lines having this structure : ...
1
vote
1answer
915 views

Bash script for reverse-engineering Android applications

I'm new to bash scripting and need some help improving a script I made for working with reverse-engineering Android applications. I wrote comments in the script itself to explain what I want to do. ...
1
vote
3answers
94 views

Counting last reported version in shell

Struggling to write a simple tool to quickly sum up the last reported versions in a bunch of files. I'm using a named pipe to get the count out the loop for the final value, but the $version isn't ...
1
vote
1answer
486 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 "...
1
vote
1answer
40 views

Nginx-WordPress conf

This is how I create am Nginx virtual host for a WordPress webapp. I did best to keep it as minimal as I can while having a working webapp. Please review it: ...
1
vote
1answer
35 views

Four-lines script to make an immediate DB and document root zip backup

What do you think of my script to make an immediate DB and document root zip backup? Any flaw you might find. Please inform me of it: ...
1
vote
1answer
55 views

Ubuntu-Nginx lightweight server environment setup

Please review the following Bash script that uses to establish a "lightweight" Ubuntu-Nginx server environment mainly aimed to run small WordPress sites (about 5 plugins, about 25 webpages, about 25 ...
1
vote
1answer
28 views

Script that makes an API call to and parses the response to get a URL from where to download another file

This is my first script and I am having a hard time writing the shortest possible code. ...
1
vote
1answer
53 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 ...
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 ...
1
vote
1answer
126 views

Bash script that creates a local environment for CHICKEN scheme (like virtualenv for Python)

Usage To create a localenv called sicp, do $ localenv sicp Activate the localenv: $ . sicp/bin/activate Check installed eggs in ...
1
vote
2answers
116 views

Finding the second highest version using bash array script and clean up files

The goal is to print the highest version and second highest version of the list of files. The version is based on the first three digit places of the version. For example, version 2.3.0.1 version is ...
1
vote
2answers
151 views

Iterating over a range of dates in a shell script

I have been working on a script that can be used to automatically pull the batch ids that were processed 4 days ago and which need to be processed tomorrow on the server. The batch IDs from 3 days ago ...
1
vote
1answer
39 views

Open github via commandline

I'm learning bash and my goal here is from any repository on my computer to be able to type github and it will open the remote ...
1
vote
1answer
68 views

Setting up a development environment - 2

This is the new code after following the advice from here: Setting up a development environment General feedback is requested. Also, should I be using $() or <...
1
vote
1answer
173 views

Resolving the path to a Bash script

I wrote a function to resolve the full path to the current Bash script, and I'm wondering if it's SOLID: ...
1
vote
1answer
305 views

Format conversion of localized file | xliff to csv

I need a revision for this code... it's a working code, but i'm pretty sure that can be simplified or even improved. This is for converting a normal xliff file (localization file) into a csv, having ...
1
vote
2answers
139 views

Floating-Point data input in Bash and C

I wrote a function that dynamically stores statistical data. I tried to clone the functionality of how I had originally written my solution in Bash. Is there perhaps something I could improve, or do ...
1
vote
1answer
179 views

CommonJS modules/require at build-time with bash and M4

I've implemented CommonJS Modules 1.1.1 as a simple bash script with a bit of help from M4. I'm interested in comments on the shell scripting and the javascript output. Some specific questions on ...
1
vote
1answer
105 views

Read integers from text file and write to CSV file

Background: I've recently started learning bash due to my new job in a VFX company. We backup all of our media to LTO tapes (one master and one clone). I was tasked with writing a script that split ...
1
vote
0answers
20 views

S3 Bash Tools Part 2

This is a follow on to a previous question: Part 2: Upload/Download All the code I am submitting here is available in github The reason to write these tools is so I can prototype and quickly ...
1
vote
0answers
63 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 ...
0
votes
2answers
195 views

Command line google searching

I have a bash script that is meant to start a google search from the command line. I am also looking to implement a way of getting source code for the search page possibly through a subscript. This is ...
0
votes
1answer
25 views

Refactoring with many duplicates using Bash [closed]

I have a curl based working bash script, but I have many duplicates on the "CURL" body. How do I improve it efficiently to eliminate duplications? ...
0
votes
1answer
39 views

MySQL CLI: Create a MySQL user & DB

Please review my Bash code to create an authenticated, all privileged MySQL user plus a DB with the same name, through the MySQL CLI: ...
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. ...
0
votes
1answer
2k views

Is this iptables firewall bash script good? [closed]

I'm learning to use iptables to implement it in my company software. The goal is either to prevent the major attacks and to have good speed transferring files (ssh and ftp). Can you help me to improve ...
0
votes
2answers
61 views

Bash Script for file auditing, push information to server and be able to view in a web page

Edit: The goal of this Question was only seeking code review and guidance in learning or tips for improvement. I apologize if that was not clear or aligned properly with the goals of this forum. ...
0
votes
2answers
48 views

“command preprocessing” with bash - string parsing and handling pipes [closed]

The following is a bash script named wrapper.sh: ...
0
votes
1answer
182 views

Print a “shebang” line, or prepend it to a file

This is a sort-of-useless "utility" I wrote to learn my way around shell programming better. My concerns are: Is the code readable? Could it be more efficient, or just simpler? The logic ends up ...
-2
votes
1answer
62 views

Merging files in Bash

I had this homework assignment: Create on the desktop a folder with your name. Copy from your account XYZ@xyz.com two files, ...