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

0
votes
0answers
11 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 ...
8
votes
1answer
78 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
65 views

Bash command helper

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", ...
1
vote
0answers
14 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
28 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
18 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
52 views

Merging files in Bash

I had this homework assignment: Create on the desktop a folder with your name. Copy from your account [email protected] two files, ...
3
votes
2answers
91 views

Bash script to capture error message and change exit status

I'm working with the Perforce command line client. I ...
3
votes
1answer
40 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
40 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
73 views

Calculate the Fibonacci sequence using bash

I would like your opinion on my shell script that prints the Fibonacci sequence. ...
2
votes
1answer
109 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
31 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 ...
4
votes
2answers
67 views

CGI script for managing Unix passwords

All the services I run on my server are based on Unix accounts. Since most web services have their own users and perform all the account management separate from the actual system accounts, I created ...
3
votes
1answer
66 views

Bash plugin to setup project for books

I'm writing a bash plugin to help people create books in a specific way. It's an ordinary shell script to setup the project and create its subresources. I'm using a loop to create barebones assets and ...
6
votes
3answers
42 views

Pulling Docker Machine IP

I am working with MongoDB through Docker, and I have a terrible bash command to pull the Docker Machine IP so I can sanely connect locally. ...
4
votes
2answers
274 views

forever.sh - should keep a process alive forever

This script's only responsibility is to keep a process alive. Forever. It's sole dependencies shall be bash and coreutils. I'm ...
9
votes
1answer
60 views

POSIX shell compatible and POSIX conforming dirname implementation

The discussion in the comments of this answer made me wonder how hard it would be to write a built-in only version of dirname. This is what I ended up with but I'm ...
2
votes
1answer
41 views

Hide/un-hide directory and open directory based on argument

This code checks to make sure a directory is hidden and if not hides it. Then if hidden it will prompt for password and if password matches it will un-hide it. There is also an argument to open ...
3
votes
2answers
42 views

Advanced CSV-to-SQLite converter

I just wrote an advanced CSV parser that translates CSV to SQL(SQLite Compatible) statements, which are then inserted into the database. It translates variable names in the CSV to values defined in ...
4
votes
1answer
45 views

Optimising script that does simple renaming of files

I have recently written some code in Bash where I'm starting to program some things and I think I'm overcomplicating the script I wrote. I'd like to make it simpler so that in future I would avoid ...
3
votes
1answer
41 views

GRE Tunnel Script

I've made this script above for GRE Tunnels and I'd like to know how I can improve it. Also, at the bottom, you'll see "Do you want to forward more ports." I want an easier method of asking this and ...
1
vote
1answer
22 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 ...
9
votes
2answers
64 views

Add license to beginning of files

I'm trying to come up with a script that will add license headers to certain files (depending on extension). My Bash is very average, so any guidance would be much appreciated. I'm not quite sure ...
4
votes
2answers
74 views

Who needs clean configuration? Swapping server.xml

So I'm working on a project that sometimes requires me to switch my server configuration. This is due to some circumstances with database drivers and names that are "too expensive to fix" ... That ...
8
votes
2answers
256 views

HTML Book Compiler

I have written a BASH script to parse and compile HTML code into a single page. The script works as expected, although my code is not completely re-usable and the standard output messages could be ...
2
votes
2answers
40 views

Simple Bash Music Player - follow-up

This question is a follow-up to this question. This is a year later, but it has the same context: I wanted new reviews for the updated code from the original question, but this time I wrote the code ...
8
votes
2answers
615 views

Fizz having an argument with Buzz

For my current project I need to validate responses. The requests will be send from multiple different shell scripts and should be controlled from another script. I'd never targeted a ...
8
votes
2answers
96 views

Fine tuning of an informative replacement for rm

I want to replace rm by a more informative variant: I would like to see which files will be deleted, along with their size, and I would like this information to use ...
6
votes
2answers
195 views

Address book app to learn bash

I'm fairly proficient in C and Python, but want to learn some skills for administrating my new Linux machine. I wrote this simple address book app to teach myself shell scripting. This is the first ...
4
votes
2answers
55 views

Bash script to replace substrings in a file with strings

I am an editor of the Funtoo Linux wiki and was looking to create a shell script that would help to ease the updating of pages on the wiki that use old tags by replacing certain deprecated tags with ...
4
votes
2answers
79 views

Validating a credit card number using Luhn's algorithm

I implemented Luhn's algorithm explained on Wikipedia to validate a credit card number, in Bash. Does this code follow good practices? ...
5
votes
1answer
60 views

Bash script to backup from S3 to GC

I'm working on a script to backup S3 to GC everyday. I'm not sure if my script has any potential bug or error that might have destroyed anything from both sides? The data is quite sensitive and I ...
6
votes
2answers
140 views

Keep track of Terminal access

I am fairly new to bash (I have about 3 months of experience), and now I've written my first real application (sort of). It's a function inside of ~/.bash_profile, ...
7
votes
2answers
124 views

Text centering function in bash

I wanted to center some text in my commandline application, so I came up with this function. ...
10
votes
1answer
461 views

Calculating pi using bash

I've written a little program to calculate pi using the Nilakantha series: For this formula, take three and start alternating between adding and subtracting fractions with numerators of 4 and ...
8
votes
1answer
90 views

Bash script to remove unwanted git objects

A while ago, someone at our office thought it'd be a great idea to start tracking a number of fairly large binary files in one of our more important repositories. We noticed our builds were slowing ...
4
votes
1answer
62 views

Restart Services Automatically

I have been working on a script that automatically checks on the state of 2 services that I require to be running 24/7 on a server that I manage. The script works as I need, but I would really like ...
4
votes
2answers
103 views

Installing and removing kernel module RPMs

First, the script checks to see if it is installing two kernel module packages or removing them by looking at the first parameter. If no parameter is provided it complains and exits. If installing, ...
3
votes
1answer
72 views

Append the first half of the first line of /etc/hosts to a conf file

I have to edit a config automatically before starting a service in a docker container (a storm supervisor), and I want to append something like this in ...
12
votes
1answer
64 views

Load SSH key remotely

I often create new accounts or virtual machines, and then have to load my SSH public key/signature in to the authorized keys on that account. That process can be tedious, so I created this script that ...
3
votes
1answer
22 views

Bash Compress Managed Directory Ignoring .git, bower_components, node_modules, etc

Fairly easy way to compress a wordpress plugin (or similar) as a zip file without including all the dependencies used to create and manage the development, but which don't belong in the final product. ...
3
votes
2answers
31 views

Changing filename and copying in bash

I wrote a script which changes names of last downloaded songs and copy them to music directory. Can it be written better? ...
4
votes
3answers
68 views

Checking dates against a .properties file

I am writing a script that will check the set values against a .properties file and I am just wondering if there is any nicer way to write what I have here. ...
4
votes
1answer
199 views

Shell script that copies configuration and dotfiles to repository

A while ago I had the idea to store all the important configuration and dotfiles from my system in a Git repository. That saved me a few months ago: My harddrive died, but I could get back to work ...
1
vote
1answer
38 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 ...
2
votes
1answer
53 views

Bash menu for accessing network equipment

I wrote a menu in bash to access network equipment, but now there are too many of them to show in one screen to permit selecting one without scrolling up or down. I need it to be improved. I've ...
4
votes
3answers
99 views

Bash script that checks if font is installed and installs it if necessary

This checks if a font is installed by using fc-list and grep. If the particular font is not installed, it offers to install it ...