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.

learn more… | top users | synonyms

1
vote
1answer
9 views

Bash script to create directories and files

I wrote a pretty simple bash script. It takes a directory with subdirectories with incremental prefixes in their names (01test, 02test, 03test), creates a new ...
1
vote
2answers
26 views

Bash “Rotating” MySQL backup

I'm quite a novice in shell scripting so far, but i'm learning and getting quite comfortable in writing shell scripts, but i have a lot to learn. The snippet at the bottom of the page creates backups ...
0
votes
1answer
9 views

Shell agnostic startup flow - env, profile, rc, login

The goal of these files is to have some common behavior between Bash and Zsh when starting them. As is known, when Bash starts as a login shell it will source the first found of the following in your ...
4
votes
1answer
20 views

Bash script to open or close gnome-terminal with a single keybinding

I wanted to bind a single hot key to open and close gnome-terminal in a way similar to terminal emulators such as tilda or guake. I use Ubuntu, and have configured this script to be executed when I ...
3
votes
2answers
27 views

Nagios plugin webdav check 2

Original post: nagios plugin webdav check According to the good advice I have received I've made some modifications to the code: ...
3
votes
2answers
39 views

nagios plugin webdav check

I have written a small plugin for nagios to check a WebDAV server. It is supposed to connect using a username and password and upload & delete a test file This is my code: ...
3
votes
2answers
41 views

Grep for pattern recursive and disable file

On a shared host, I'd like to setup a cron which scans folders recursively for some base64 malware strings. Therefore, I've written the following script: ...
5
votes
0answers
41 views

Automated owncloud installation script

Here is a shell script which installs and configure owncloud on a Debian server. It also installs apache2 and MySQL as dependencies and fail2ban with a specific rule for owncloud. Apache2 is also ...
2
votes
1answer
31 views

Bash script to install vim configuration files

For the first time ever I decided to write a bash script. It works fine, but I'm feeling that I didn't write the most efficient code in order for future extension of the script. I also don't really ...
3
votes
1answer
33 views

Bash function to parse git status

I have a function here and wondered how well this can be refactored. I currently have this: ...
2
votes
1answer
26 views

Finding hidden field values in a web page before submitting a login form

In order to submit a login form using wget, I need to find the values for the hidden field that were added to the form recently. Grepping for the names gives the ...
5
votes
2answers
251 views

Cleanup and server restart script

I have written a simple script for managing our Tomcat and Apache instances for deployment. What this script basically does is, when called, it copies the ROOT.war ...
3
votes
2answers
40 views

Dockerfile to install Apache

I'm getting started with Docker, and I've set up a very simple image built from a Dockerfile. It's based FROM the ubuntu image, ...
5
votes
1answer
32 views

Function to get specified key from /proc/cpuinfo

On Linux, the file /proc/cpuinfo returns a set of key-value pairs, where the key and value are separated by a colon and each pair has its own line. It's a bit more ...
1
vote
1answer
31 views

Print values of an array while stripping out some parts of the string

Is there a more efficient way to run this? I am especially interested in a way which perhaps does not require a for loop... ...
10
votes
1answer
418 views

Bash command helper in C

Previously, I had written this program in C++ and asked about it here on Code Review. After spending some time with C++, I desired to become more familiar with its namesake. This is my first C ...
4
votes
1answer
47 views

Editing a playlist configuration file

What I'm trying to do here is first set the first eight variables to the proper default values. That's the first area I'm thinking there might be a way to optimize. Is there anyway to set both ...
5
votes
2answers
81 views

Bash script to download sequentially numbered images

This is a pretty basic bash script (3.2 on Mac). I am downloading 584 images from a site in order to create an album. ...
8
votes
1answer
45 views

Automating a WordPress install

I do not have a whole lot to do over winter break, so I wrote this little script to automate a Wordpress install (currently can only install once instance) on a fresh Debian server (tested, working ...
6
votes
1answer
58 views

Script to redo a rails migration easily

I need to redo a migration occasionally. The workflow is usually something like this: find or ls | grep the migration using ...
6
votes
1answer
57 views

Notification script | from RSS to Email | Bash

This is a script that must send an email at each new article published on a specific website. Any suggestions or improvements to do? ...
6
votes
2answers
29 views

Checking and converting [[HH:]MM:]SS input format

I would like to use the following routine in my job submission bash script which expects the allowed walltime in the format [[HH:]MM:]SS. (Brackets indicating ...
0
votes
2answers
45 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 ...
1
vote
1answer
36 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 ...
5
votes
1answer
48 views

Format conversion of localization files | 3txt to xliff

I'm trying to build an xliff for localization from 3 specific files: one contains a list of IDs, the other a list of source strings and the last, a list of translated strings. Basically, each file ...
7
votes
3answers
340 views

Egg timer in Bash

I just started to learn programming, going through a lot of different tutorials, trying out different programming languages and I stumble in the same sort of questions all over the place. I give you ...
3
votes
2answers
42 views

Return the first number found greater than the provided input number (13 digits)

This script converts the numbers to be at least 13 characters long (for UNIX_MS strings). For use with timestamps, I'm having issues with it being very slow. I wanted an alternative to grepping for ...
10
votes
3answers
399 views

Shell Script (Bash) to sum multiples of different arguments below a number

I'm interested in learning how to create shell scripts with bash so here's one of my first exercises, taken from here. It is an extension of the problems Elementary - 4 and 5. The goal of the program ...
2
votes
2answers
79 views

Build script for an operating system written in C++

I recently started following the James M Kernel Dev tutorials and was able to create an operating system in C++. Here is the source on GitHub. I have a couple of questions: Is my coding style ok? ...
2
votes
2answers
34 views

Parsing users from a list of commands for email notifications

I want to make a list of the last words on each line of a file that looks like this: ...
7
votes
3answers
71 views

Running a script recursively in subdirectories

I got tired of running the same command in multiple directories, so I thought "there has to be a way to make this easier". The commands I was running was mostly ...
5
votes
1answer
35 views

Pseudoportable C script pattern - follow-up

See the initial/previous iteration. I have rewritten the script following the answer of @200_success. Now it looks like this: ...
5
votes
1answer
56 views

Pseudoportable C script pattern

(See the next iteration.) From time to time, while working with a command line in *nix family of operating systems, we have to write those scripts doing a rather specific task. Usually we use ...
3
votes
1answer
21 views

Bash function to dynamically move N directories above the current directory

up moves N directories above the current directory (executes "cd .."" N times) When executed without input values it moves only one directory above the current directory When executed with input ...
4
votes
1answer
61 views

Unlocking spreadsheet files quickly

I've created a program for my job that unlocks spreadsheet files quickly and efficiently. What we use to have to do before this program is we'd have to go into the system, search for the file, kill ...
7
votes
1answer
124 views

Encrypt message for sending over non secure network

wRecently needed to swap keys with a colleague on the other side of the country. This script encrypts a file using the other persons public key that is stored on github. It outputs a script that will ...
6
votes
1answer
91 views

Bash command helper in C++

I'm writing a program to help with remembering complex bash commands. On invoking the program, it asks for a description of the desired operation, e.g., "increase volume" or "find orphaned packages", ...
2
votes
1answer
44 views

Expanding tilde inside assignments and strings in bash

Inspired by the work Charles Duffy did in this answer and the work of Jonathan Leffler in this one and because I couldn't leave well-enough alone. I went and wrote expandTilde.sh: ...
4
votes
0answers
33 views

SLOC Counter Script Optimization

I'm a HPC guy so I'm all about "make it work, then make it fast." I have a little bash script which gets a Physical Source Lines Of Code (PSLOC) and Logical SLOC (currently just of Java code, but it ...
18
votes
3answers
1k views

“Up” script for moving up directories quickly

A long time ago I created a script for moving up directories very quickly in the command line using the command up. You can find usage notes here. It's a very ...
2
votes
1answer
21 views

Listing Docker Images without registry URI

I have a private container registry behind a firewall that will need some Google registry images. To make sure things are updated sanely, I'm writing a mirror script in Bash. I have one line that ...
2
votes
1answer
65 views

Tagging the directories and switching between them by tags

MOTIVATION I have this small software package that allow users to maintain a simple text file that looks like tag1 path1 tag2 path2 . . . For example, it may ...
-2
votes
1answer
55 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, ...
3
votes
2answers
96 views

Bash script to capture error message and change exit status

I'm working with the Perforce command line client. I ...
3
votes
1answer
43 views

Installation script for Mac OS tool

I have a bash script I'm trying to distribute to people in my class. The script requires some dependencies to operate, namely wkhtmltopdf and ...
0
votes
1answer
46 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 ...
5
votes
2answers
129 views

Calculate the Fibonacci sequence using bash

I would like your opinion on my shell script that prints the Fibonacci sequence. ...
2
votes
1answer
193 views

Chrome extension to get youtube video's URL

I needed something that would get the URL of a chosen video from YouTube and store it in a file. Since I didn't find a way to write/edit an existing file with the URL alone, I had to use a patchwork ...
2
votes
2answers
32 views

Split redirecting to multiple files in bash

A function mycommand which runs command and: Gives me three log-files which are: *.stdout.log: everything from ...