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.
3
votes
1answer
17 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
26 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
25 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
243 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
35 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, ...
4
votes
1answer
30 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
26 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
414 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
76 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
43 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
56 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
54 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
28 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
42 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
47 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
338 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
395 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
77 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
68 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
34 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
19 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
60 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
119 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
32 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 [email protected] 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
117 views
Calculate the Fibonacci sequence using bash
I would like your opinion on my shell script that prints the Fibonacci sequence.
...
2
votes
1answer
182 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 ...
4
votes
2answers
74 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
67 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
50 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
276 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
63 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
43 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
50 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
50 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
50 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 ...