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.
4
votes
2answers
434 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 ...
-1
votes
0answers
10 views
Monitoring an output file and killing a program when possible strings are found [closed]
My first attempt was with this code below which function is to dynamically monitor the outputs of a program and then kill the program if possible strings are found. It worked when I was looking for ...
3
votes
1answer
43 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 ...
-1
votes
0answers
9 views
Bash script for showing newly introduced env variables [migrated]
I'm making this test script to help me reverse engineer scripts in charge of setting the dev environment.
The script:
...
2
votes
0answers
28 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
22 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 ...
8
votes
1answer
315 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
26 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 ...
1
vote
1answer
15 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
43 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
25 views
2
votes
1answer
28 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
22 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
42 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
27 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:
...
1
vote
0answers
29 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
47 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
80 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
29 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
48 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
15 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
25 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 ...
2
votes
0answers
34 views
3
votes
2answers
40 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
51 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
47 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
66 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
33 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
40 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
34 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
261 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
55 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
38 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
427 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
86 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
48 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
66 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
72 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
3answers
45 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
48 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
39 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
354 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
44 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
417 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
80 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?
...