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.
-1
votes
0answers
8 views
Safe move in Linux [on hold]
safe-rm is available for Linux admins. But safe move is not available for Linux admins.
I have written the script, kindly review this as I am going to add it to production server.
The objective of ...
2
votes
1answer
13 views
Merging directories and keep files that have more lines
Goal
My goal is to merge directories. Whenever a file has the same name in two or more directories, then only the one that has the highest number of lines should be kept. If both files have the same ...
3
votes
1answer
33 views
Backup MySQL database for Django projects
I have a usual Django application with a single MySQL database. The purpose of this shell script is to backup a MySQL database every midnight by crontab and check that everything goes right.
The ...
4
votes
2answers
51 views
Generate SQL UPDATE from Excel CSV file
I must write updates in a database from a flat file (CSV). I want to do that in the shell, with tools such as AWK.
...
5
votes
1answer
42 views
Bash function that allows running user aliases with sudo on Ubuntu
I wrote this little Bash function to replace my sudo command.
It checks whether I have an alias for the given command and runs the aliased command instead of the ...
2
votes
2answers
33 views
High CPU utilisation for Logs Manager shell script
I have written a shell script to manage the tcpdump pcap logs and syslog files in my Linux board, so as to maintain the disk usage to maximum of 70%.
The script checks for the disk usage every ...
2
votes
1answer
28 views
Fahrenheit / Celsius temperature converter - follow-up
This is an updated version of the script Fahrenheit / Celsius temperature converter. I have changed the script to be non-interactive, using positional parameters instead of asking for user input once ...
2
votes
0answers
43 views
Log all Google Chrome browser activity
This script documents every website visited and writes the text content of each webpage to its own individual file. It seems to work as intended. Is there anything I could do to improve it?
...
3
votes
1answer
49 views
Bash manual page selection menu
I wrote the following script in the hopes of streamlining the finding and reading of multiple manual pages. Since I am always looking up different utilities' manual pages I thought this would a good ...
3
votes
2answers
47 views
Counting unique visitors in access log
I'm aware I am probably reinventing the wheel somewhat here, but I am trying to teach myself simple bash coding by completing simple tasks such as parsing files.
To that end I am looking to learn ...
1
vote
2answers
54 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 ...
4
votes
1answer
89 views
5
votes
2answers
378 views
Fahrenheit / Celsius temperature converter
This is a simple bash script (hopefully with a little style as well) for converting temperatures from Fahrenheit to Celsius and vice versa.
...
5
votes
1answer
32 views
Customized date and time display
A simple reworking of the Bash date command to my own personal liking. Possibly a rather trivial task; I just wanted the date and time to be in the form of:
<...
4
votes
2answers
46 views
Bash script for setting up a LAN to WLAN router
I wrote a bash script for the Raspberry Pi 3 (Raspbian) which has the main task of setting up a LAN to WLAN router. In addition it makes some things nicer for the intended users who have Windows ...
3
votes
1answer
25 views
3
votes
0answers
51 views
Laravel Docker-Compose
I've created a repo for some Docker containers that work together with docker-compose to make a very easy and quick installation for Laravel including nginx, mariadb, and redis. Laravel is known for ...
5
votes
1answer
49 views
`ls` indicates when directory is empty/full of dotfiles
I want ls to print a message when run on an empty or full of dotfiles directory. Instead of:
$ ls empty_dir/ dotfiles/
$
I ...
3
votes
1answer
30 views
Moving WordPress database and files to new host
I've written a script in an attempt to try to automate moving hosts from old hosts to our new docker containers.
All feedback and input appreciated!
...
3
votes
3answers
62 views
Collect, filter and display archive logs on demand
Wrote a php site to gather/filter/search daily archived logs from the archive directory using bash cat and ...
2
votes
1answer
32 views
Shell script to archive files to AWS S3
This is a simple script that moves files to S3 if they are > 14 days old. It ignores files that are < 14 days old. If the file is successfully synced to AWS S3 then we can remove it from the server....
0
votes
0answers
36 views
Robust bash function to find the root of a git repository
I'm trying to write robust code which will print the root directory of a git repository.
How can I improve this code for:
Robustness
Style (eg use of subshell ...
6
votes
1answer
39 views
Extracting Linux configuration information using Bash and Perl
For few days I'm thinking about making my code faster and using less CPU. This code is a statusbar that runs in a loop. I'm asking because there's a lot of perl and I'm wondering if it could be done ...
2
votes
1answer
41 views
Shell script wrapper for Docker build and run
I have written a simple wrapper for docker build and docker run that allows me to build and run my image without having to use ...
6
votes
1answer
65 views
Coloured bash prompt including git status and previous exit code
I wanted to create a short, informational and colourful prompt.
My prompt includes:
Exit status of last command (if not 0)
Distinctive changes when root
rsync-...
4
votes
1answer
30 views
Yum Notification Script
This is a Bash script I wrote to email me when updates are available for my server. I'm new to bash programming, so I don't know if I've done this well.
...
5
votes
1answer
16 views
Script to record an inventory of a backup
This is a script designed to make an inventory file which records the
contents of a directory allowing verification that a backup has the
same data. The same script can also
A full github repo is ...
4
votes
1answer
36 views
Server setup script for Redis, HAProxy and Node.js
I wrote a pretty basic setup script that handles most of the setup for a Three-server solution. The solution and setup file are available on GitHub
The three servers are Redis, HAProxy and Node / ...
6
votes
3answers
79 views
Bash script to extract HTML comment into a Markdown file
I learned Bash a million years ago. I just wrote this simple script used to get the first lot of HTML comments from a file, and spit it out in order to create a ...
12
votes
6answers
717 views
Bash script that lowercases files
I have the following bash script that:
Finds all files with .cfc and .cfm extension and converts them to lowercase
Stores the ...
4
votes
1answer
56 views
Raspberry Pi headless server using bash and USB automounting
Revised from: Bash scripts and udev rules to handle USB auto mounting / unmounting
Tested:
Uses USB insert/remove to control a headless Raspberry Pi 3 with Raspian Jessie Lite
Changes:
Implement ...
2
votes
1answer
60 views
Bash scripts and udev rules to handle USB auto mounting / unmounting
Very new to Raspberry Pi and bash, but working on a headless server that will run a streaming app from USB audio card.
The plan is to take a USB card with settings file, and when inserted, the usb ...
3
votes
1answer
48 views
Shell script to display environment variables
This shell script writes my environment variables. If there is an argument, the shell script will grep for the argument in the environment variables.
...
6
votes
1answer
32 views
Script to download sequentially named files, rename them, and delete smaller files
I've written a little script to download sequentially named files, rename them, and delete files smaller than an certain number of kilobytes. I came up with this but I'm not too happy. Any advice for ...
4
votes
2answers
23 views
Isolate URLs from other text around it and put each on own line (with sed)
I have a small shell script that uses sed to take an input file of URLs with hand-written notes around them and strips the notes and puts each URL on its own line. ...
6
votes
1answer
75 views
Git tag release build files and reset to commit without
This is part of a library that wants to release builded files (eg dist/*) when published to npm and bower. However, I don't want to commit those builded files for ...
6
votes
0answers
24 views
Flac Converter And Organizer
I really like flac files, but my phone can't store them all. So I made a script for converting them, that slowly became a full featured flac organizer. I'd like to improve my programming skills, as ...
8
votes
1answer
92 views
Baby-sitting bash script using DVD drive
This is the script I wrote to make an automated POC baby-sitter in 5 lines.
I first found this on a GIF or meme site and thought of making a POC script that does the same.
...
4
votes
1answer
26 views
Parsing Gaussian09 frequency calculations, reformatting depending on desired output
Quite similar to my earlier review this script parses a frequency calculation and reformats the found values to either fit into one row for easier importing into a spreadsheet software or a formatted ...
7
votes
1answer
859 views
Bash script to simplify Git deployment workflow
In my company I follow the following workflow. (I think it can be defined a kind of 'Continuous Integration'.)
Workflow:
We have 3 fixed branches (staging/<...
4
votes
1answer
82 views
A little advanced mouse clicker in Bash for Linux
My today's goal was to create a little advanced mouse clicker in Bash for Linux powered by xdotool. This clicker implements 15 pixel random range in which it clicks ...
2
votes
2answers
17 views
Resolve dependencies from output of PBS queueing system
I have written a script, that reformats the output of qstat -f1 of the PBS queueing system. Unfortunately this project is by far too big to post here complete, also ...
10
votes
2answers
716 views
JSON Parsing in Bash
I have a json file which needs to be restructured.
The following is the code.
...
4
votes
2answers
48 views
Parsing Gaussian 09 output for energy statement on one or more files and reformat it to a table
I am a computational chemist working with the program Gaussian 09. After I manually check the output(s) I want to create a summary for easier processing of the obtained values. Also avoid opening all ...
3
votes
2answers
68 views
Bash script to perform LUHN check
The following Bash script takes a single parameter (the PAN) and exits with 1 if the PAN does not satisfy a LUHN check.
...
3
votes
1answer
63 views
Install Ruby using rbenv in a bash script
I want to write an automated bash script for installing Ruby and Rails using rbenv, but I am getting session reload issues in the terminal.
...
1
vote
2answers
56 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
93 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
1answer
54 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
61 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 ...