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

Install ruby using rbenv in bash script

I want to write an automated bash script for installing ruby and rails using rbenv. But I am getting issue of session reload in terminal. My bash script:- ...
1
vote
2answers
42 views

Crawling SPOJ through cURL and C++

I am trying to write industry standard code. https://www.quora.com/How-do-I-follow-a-user-on-Spoj-for-solving-problems-Refer-Details Someone gave me this A2A. And I wrote this code for it ...
4
votes
2answers
88 views

MacPorts - Quick Install Script

I wrote this script to automatically install the relevant version of MacPorts. It's supposed to be used in a fashion similar to the official installer for HomeBrew. FYI: The real reason that I ...
1
vote
0answers
41 views

Write the running time to file without capturing the program's output

I want to run an application and write (append) its processing time into a file. Also, I want to see the stdout and stderr output on the shell, but don't want to write it in a file. After running the ...
4
votes
2answers
44 views

Sorting a file with three-line blocks by the second word of the first line in each block

I have a text file with the following three line pattern with blank lines in between. My script sorts alphabetically by each person's last name and preserves formatting. I would love to see other ...
2
votes
1answer
73 views

Testing a shell command interpretor

I've written tests that use Bash for testing a custom shell. I think the tests work but I'm sure you know better because this is my first test I write this way. ...
3
votes
1answer
27 views

Bash script that displays and kills selected processes

This is my first Bash script and I decided to use what I've learned so far to help manage stray processes while I develop in my *nix environs. I've tested the script extensively and it seems to work ...
5
votes
2answers
51 views

Yet another bash backup script, using rsync --link-dest

I’ve written this bash backup script. It uses the --link-dest option of rsync; that way, the user have access to the backed data ...
5
votes
1answer
35 views

Bash script for xrandr modification

Simply, I call the script (brightness.sh) and pass a three character value as an argument. I've got commands to strip individual numbers for math processes, and then the final commands to apply the ...
2
votes
1answer
27 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 ...
2
votes
1answer
29 views

Read group of keywords from file, modify value, store new group to variable

I would like to use the following routine in my submission script for GAMESS calculations. I am not entirely sure if this is the optimum way to go. This function would need one of the messaging ...
4
votes
1answer
33 views

Checking if input file exists, assign output file destination, prevent overwriting any files

I would like to use the following routines in my submission script for GAMESS calculations. Before I do, I would like to get some input if I can improve it somehow. The three messaging routines ...
4
votes
2answers
460 views

SSH passing your Public key to all the users on remote host

I've grown tired of typing my password back and forth to all the hosts you connect to, i want to be able to jump to every single user on all the hosts with ease. So i've made this script with a ...
4
votes
1answer
49 views

Bash script to determine a distro, update, upgrade and install the apps I use

This is my first bash script. I am trying to learn scripting and needed an idea. This is the first idea I came up with. When I used to distro hop I had to reinstall everything. This helped me out once ...
2
votes
0answers
33 views

Bashscript - Find and run main.py file (part of vim-Python IDE)

I try to get into Python and thought I build together my own IDE. Most of it consists of different addons for vim and changes in the vimrc (which of course I simply copied of google), but I also ...
1
vote
1answer
28 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 ...
7
votes
1answer
331 views

Setting up a development environment

I'm looking for feedback on improving the structure of this code. Also, I could not find the command line executable for Chrome. General feedback is also requested. ...
4
votes
1answer
33 views

Using arrays to read in file, append it with parsed program output and overwrite original

Yesterday a friend of mine asked on U&L: How to optimize 'grep'-and-save? I will summarise shortly. The output of the torque pbs queueing system tool qstat ...
2
votes
1answer
22 views

Wordpress downloader and unpacker

Wrote a small bash-script today that downloads the latest swedish wordpress archive , extracts it and writes wp-config.php Would appreciate any feedback that could improve it / prettify it. The ...
4
votes
1answer
52 views

Watch log dir for new file, automatically tail to slack

We have a process that outputs to log files in the format /var/log/xxx/YYYY_MM_DD.log - the file name is chosen programmatically and is not rotated using logrotate ...
3
votes
1answer
47 views

Simple load testing script in bash

Here's the code ...
2
votes
1answer
33 views

Bash script menu

Any comments on this? Like there is a way to get rid of all the if-statements or a better way to # check model and build (which ...
4
votes
1answer
25 views

Making time lapse screenshots using Bash

My experience in bash is... well, around the Bourne shell on AIX. I wrote a semi-complex script in Bash, and I feel that it could be improved in 100 different ways. The Github project is here: ...
0
votes
0answers
49 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: ...
4
votes
1answer
32 views

Search and merge split-archive backup parts

I wrote some code which searches parts of a split-archive backup (it's an Android backup, I used flashfire to backup) and rejoins them. As you can easily see, I've achieved this by ...
2
votes
1answer
32 views

Locating the Bash history file for a user

This looks quite verbose to me, using the command substitution and echo: ...
2
votes
0answers
36 views

Start the Python interpreter with an import statement

When I'm writing Python, I wanna be able to pull up an interpreter quickly, and import what I need easily. Previously, this involved: ...
8
votes
1answer
68 views

A Dockerfile for Composer (a dependency manager for PHP)

I recently built a Docker image for Composer. I'd love to get a review of the image, the Bash based wrapper script, its recommended use, and the repository structure. Here's the Dockerfile for the ...
4
votes
2answers
81 views

Un*x terminal history wiper

Using various answers from Stack Overflow and Ask Ubuntu, I've hacked together this simple C program that wipes terminal history. It works but I'm relatively new to C so I'm not sure if everything is ...
3
votes
1answer
31 views

Generates a randomized locally-administered unicast MAC address

This is the first time I've attempted writing something in bash, and would appreciate any feedback or criticism to make it better. ...
2
votes
1answer
29 views

Bash script to create directories and files with a numbered prefix

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 ...
4
votes
2answers
53 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 ...
2
votes
1answer
19 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 ...
5
votes
1answer
33 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
46 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
63 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
51 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
115 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
35 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
50 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
44 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
266 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
64 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
47 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
430 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
50 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
90 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. ...
9
votes
1answer
52 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 ...