BASH is the Bourne Again SHell, the successor to the classic Unix sh (shell). It's the official shell of GNU.

learn more… | top users | synonyms

0
votes
0answers
42 views

SpamAssassin spam analyzer script in PHP based on sa-learn command

I wrote a small script to analyse spam messages that are spam false-positive; meaning that they are spam messages in nature but that happened to be in your INBOX folder because your spam filter failed ...
2
votes
1answer
30 views

Simple IPSec/tunnel setup script

I've developed a script to set up an encrypted tunnel between two Linux hosts, using iproute2, ssh and setkey. The goal is to allow setting up ad-hoc secure tunnels with minimum of setup and ...
2
votes
1answer
32 views

Simple bash script for opening a repository in the browser from the command line

I'm relatively new to bash scripting, and I'm wondering how I've done on this. Basically it's a script where if I'm in a github or bitbucket repository in my terminal, I can type browse-repository to ...
1
vote
1answer
26 views

Bash script to manage multiple Java Development Kits installations

I'm writing a bash script to manage multiple JDKs, the script is very simple, you have to choose a directory when you store all the jdk's, and the script maintain a symlink to the current jdk'. ...
1
vote
2answers
50 views

Bash script that can uncompress: tar, gzip, rar

This code generally works exactly as it is supposed to. I'm learning bash I'm looking for some constructive help that could help me improve my work. #!/bin/bash usage() { echo "Program for ...
1
vote
1answer
245 views

Bash Shell Script uses Sed to create and insert multiple lines after a particular line in an existing file

This code seems to work, but I'd like someone with shell-fu to review it. Is the temp file a good idea? How would I do without? Is sed the right tool? Any other general advice for improving my ...
-1
votes
1answer
24 views

bash file manipulation [closed]

I have files in a directory named so: 1welcome.avi 2introdution.avi I have a rhcsa.txt file that has what these files should be named as: rhcsa_1_welcome.avi rhcsa_2_introduction.avi both the ...
1
vote
1answer
71 views

run external command from python

I have to run an external program from python. External program makes many temporary files (which conflict with other instance of same program). My strategy is Get current directory (native) path, ...
1
vote
2answers
99 views

Shell script to copy video files to another folder

I recently started running but hate running both in the quiet and with music, so i've been listening to podcasts. Unfortunately, I've caught up with all my favorites and so I've started listening to ...
2
votes
1answer
54 views

Improve a script to generally check status of several git repos

I've tried to write a bash script that gives me a general overview of the status of git repos I have cloned/created. It's not meant to replace git status by any means, but give an overview of several ...
2
votes
2answers
89 views

Need some advice and feedback on my C code calling Bash functions

My intent is to use Bash functions defined in functions.sh in a C program. I am doing this so that I don't have to rewrite the Bash functionality again in C. I want to use one common library for ...
4
votes
2answers
30 views

Make a directory and change to it

A basic shell function to create a directory and change to it goes like this: mkcd () { mkdir "$1" && cd "$1"; } This works well in many cases but breaks in unusual cases (e.g. if the ...
5
votes
2answers
76 views

bash: Can anyone think of how to make this nicer/prettier/more readable?

my first post. Just created a teeny little script to count the seconds until I get auto-logged off. I already solved my issue with my ssh client settings, but I'd still like any help making the bash ...
0
votes
1answer
58 views

Parsing of a file using sed

I have a file containing lines having this structure : var marker25 = createMarker(point, '<div id="infowindow" style="white-space: nowrap;"><h3>Katz\'s Deli</h3>205 E. Houston ...
2
votes
1answer
86 views

Please review my statistical simulation to help me improve my C

I've written the following program as a submission to the German Federal Computer Science Competition for highschool students. The program makes the following simulation with a given number of days ...
1
vote
2answers
128 views

Bash Backup Script

The following script closes a virtual machine (which is run in a screen session), waits for the session to close, creates a backup of the VM, and restarts the VM. The shutdown and bootup scripts speak ...
3
votes
2answers
101 views

Bash Script(beginner) - Code Improvement Suggestions

I am writing a simple script to automate my regression testing. I am new to bash scripting and my goal is achieve the most efficient and clean code. I have written a simple function to allow me to ...
3
votes
2answers
65 views

A little bash function, assigning attributes

This function checks if an attribute has been passed and if not, asks user for input. I'm new in bash scripting and would like to get some feedback. Is it okay or should I refactor this code somehow ...
5
votes
3answers
77 views

Can I speed up this simple versioning/backup script?

I'm writing a simple automatic backup/versioning bash script. It should basically mirror a directory structure somewhere, and then copy files over there when they've been altered. The ghost files ...
3
votes
1answer
97 views

An attempt at making a neat ls

This is a simple script to make ls output first folders, then files, then other stuff (symlink). I think this is really neat and would like to share the script in exchange for comments. It should be ...
2
votes
1answer
120 views

Am I making any beginner errors in the bash script for adding trusted timestamps to Git commits?

I don't write too many bash scripts and I can usually struggle my way through getting the odd thing I need working, but my scripts always seem to feel a bit brittle. Below is a script I wrote for ...
2
votes
1answer
111 views

Run all scripts in a sub-directory

When git runs my post-receive hook, I'd like it to run all the scripts in the subdirectory post-receive.d. My script is as follows #!/bin/bash SOURCE="${BASH_SOURCE[0]}" DIR="$( dirname "$SOURCE" )" ...
3
votes
1answer
90 views

Bash function to create the next SVN release tag

I've created the below script and would appreciate any feedback. # svn directory ^/tags/release/ # 1/ # 2/ # 3/ # 4/ # usage: svnnextrelease fixes email formatting # generated line: svn cp ^/trunk ...
1
vote
1answer
269 views

Bash script for reverse engineering Android applications

I'm new to bash scripting and need some help improve a script I made for working with reverse engineering Android applications. I wrote comments in the script itself to explain what I want to do. ...
2
votes
1answer
166 views

Tips on good practice in my bash script that logs in to a website, downloads a PDF, adds it to iBooks and uploads it to dropbox

I am running a scheduled script on my iPhone that logs in to a website, downloads a PDF, adds it to iBooks and uploads it to dropbox. All of this happens only when it has WiFi access. I want to make ...
3
votes
1answer
637 views

Shell script that verifies checksums when moving between filesystems

I coded this because it seemed like a fun project, would be awesome if someone reviewed this. Thanks! #! /bin/sh #function that checks if dependencies are installed check_software() { #check ...
3
votes
1answer
253 views

Bash arrays and case statements - review my script

#!/bin/bash # Change the environment in which you are currently working. # Actually, it calls the relevant 'lettus.sh' script if [ "${BASH_SOURCE[0]}" == "$0" ]; then echo "Try running this as ...
2
votes
2answers
141 views

Bash script to share snippets of code using rsync

I just got through writing a bash script so my friend and I can share snippets of code to a central file via rsync and ssh. What it does is this; Sets up ssh public key auth if not already working. ...
1
vote
3answers
861 views

Bash script to swap out, edit host files

So this is my first useful bash script. It's meant to make it easy to switch between a "work" hosts file (that blocks sites like reddit.com, youtube.com, etc.) and my normal hosts file, and also to ...
4
votes
2answers
722 views

Bash script to send to recycle bin or trash

This is a script that emulates a recycle bin in the CLI. You can undo your last changes and delete files This is my first bash script so don't hesitate to bash me. Thank you for taking a look. #! ...
2
votes
1answer
914 views

Shell script that creates and deletes symbolic links

Right now I am working on an install and uninstall script for my vim configuration files. The install script links files and directories and the uninstall script deletes those links. I just want to ...
2
votes
2answers
311 views

optimizing a bash script chain - speed suggestions?

i am testing an application that i wrote and want to test the solution my algorithm produces to a Monte carlo solution. I use the harddisk a lot and i was wondering if there was a solution that uses ...
0
votes
1answer
100 views

Problem with writing “Bash Script” [closed]

Please help me. I have a problem with writing "Bash Script". I just began to study "bash scripts", so I need help. Could someone write to me some "bash scripts"? I'll be very grateful.
2
votes
2answers
324 views

Script to group files by extension and unzip archives

I am writing a shell script to sort my files by extension and unzip archives. It works in simple cases, but I haven't tested it extensively. How can I make it more robust against the set of file names ...
5
votes
3answers
312 views

Script to monitor a folder and compress the content

We have a Debian Squeeze server where we upload files through SFTP, and I wrote this script to automatically compress uploaded files. The script is scheduled through a cron job in an unprivileged ...
2
votes
2answers
82 views

How to improve the way I handle greping in this script

What my script does is: Append data to a file on a continuous basis. If an error pattern is observed, then do something. I need feedback on the way I am grepping for patterns in the continuously ...
4
votes
2answers
207 views

Suggestions needed to improve my code ( bash script)

I wrote a bash script to print contents of files in a given directory in a loop. I kindly need suggestions mainly on the following aspect: How can I improve command line parameters handling to the ...
5
votes
4answers
202 views

How can I simplify these bash if statements before it gets out of hand?

We have a setup script for setting up a development environment, and setting up the image libraries is getting a bit messy: # this is to get PNG and JPEG support working in PIL on Ubuntu if [ -d ...
1
vote
1answer
127 views

CommonJS modules/require at build-time with bash and M4

I've implemented CommonJS Modules 1.1.1 as a simple bash script with a bit of help from M4. I'm interested in comments on the shell scripting and the javascript output. Some specific questions on ...
1
vote
3answers
78 views

Counting last reported version in shell

Struggling to write a simple tool to quickly sum up the last reported versions in a bunch of files. I'm using a named pipe to get the count out the loop for the final value, but the $version isn't ...
2
votes
2answers
80 views

Shell script: is it doing what I think it's doing

I've not written many shell scripts and cobbled this together from examples. The 'if' condition should check if this is already running and quite if so. The 'wget' call should trigger the php page and ...
2
votes
3answers
364 views

Tiny bash script: Is sed necessary here?

I've recently discovered the power of sed; regular expressions seem like they'll take a lifetime to master. This tiny script uses both to add zero before the single digit in file names. Can this be ...
5
votes
1answer
197 views

How to improve my auto-reconnection Python script

I need some feedback here. Due to a weird issue on my server system, the network card disconnects from the network regularly. I'll fix this at a later date. But I wanted to know if the below script ...
2
votes
2answers
281 views

bash script for printer administration

#!/bin/bash # Used to add/remove printers from system (lp) # Copyright Fresh Computer Systems Pty Ltd. GREP_OPTIONS='--color=tty' export GREP_OPTIONS sanity() { # Are we root? if [ $EUID ...
6
votes
4answers
218 views

How can I make this password search more inteligent?

In a homework, there is exercice when I have a script that is used to search a password. One of the questions is if is possible to make it "more inteligent", and I'm stuck on it. The script: ...
1
vote
1answer
143 views

Is this shell script for copying files sensible, readable?

As an exercise in learning bash, I wrote this script designed to automate the process of populating a drive with uncompressed .aiff files copied directly from a CD. It saves me having to do a bunch of ...
3
votes
3answers
393 views

Need help improving a small C program

I wanted to launch a bash script (read: bash not sh script) as a root not as the user calling it, however bash ignore setuid on scripts, so I chose to write a very small script that takes a ...
1
vote
1answer
145 views

Concept for PHP Controlled, Privileged Execution (for a cPanel knockoff on Ubuntu Server)

I was thinking of building a F/OSS project as a cPanel for Ubuntu Server, since Ubuntu doesn't have this, and yet making it easy for a hosting company to use this, where users will find it just as ...
2
votes
2answers
382 views

Functions for scanning command line options

I know that getopts is available but I wanted to write my own as a way of improving my bash. Below I show two function definitions and an example of the use of them in a bash script. Finally I show ...
2
votes
1answer
164 views

service build with perl - is it correct

I tried putting a script i saw together, plus used an existing script to make something run as a service. Now I have the following pl script and the init.d / start/stop scripts. They work, but I am ...

1 2