BASH is the Bourne Again SHell, the successor to the classic Unix sh (shell). It's the official shell of GNU.
0
votes
0answers
29 views
Project Bashory - Bash History - Any suggestions on improvement?
In effort to be more effective and productive with terminals I have started building a bash script. It is for handling the bash history of concurrently running terminals, archiving old commands, and ...
1
vote
0answers
30 views
cpupower bash completion script
I wrote a bash completion script for the cpupower command but I feel that it sucks, it's too long for such a simple task and have too much case/if-else nesting.
It supports all the subcommands of ...
0
votes
1answer
26 views
Bash adhoc script
This script creates an adhoc network using hostapd.
I have tested it and seems to work reliably.
I am new to linux networking and not sure if this is a recommended way to create an adhoc network this ...
3
votes
1answer
33 views
New svn repository script
This is my very first Bash script that does something real. I'm here to learn, so please tell me if and how this can be done better.
#!/bin/sh
# Daniele Brugnara
# October - 2013
if [ -k $1 ]; then
...
2
votes
0answers
34 views
OSX: AppleScript to close running processes
I've been trying to emulate MS Windows behavior on my OS X and close processes that do not have a window.
What I'd really like to do is "quit" the process on clicking the red "x" button.
Instead, i ...
2
votes
2answers
48 views
Automating easy-rsa cert creation with Bash script
In order to make cert creation with easy-rsa as practical for others, this script was created and it works so far. The questions are:
where can it be improved?
are there flaws that are not obvious ...
0
votes
1answer
26 views
Automating the install of postgresql from Shell
When my debian server deploys it can run a shell script so I wanted to make one to install postgreSQL, create a role, create two databases and then import a schema into one.
Can anyone please look ...
0
votes
1answer
35 views
Trying to remove dashes from files [closed]
Here is what I have. It runs OK unless there are no files with dashes, then I get:
mv target filenameblah is not a directory.
What am I missing?
for i in *-*
do mv $i `echo $i |tr -d -`
...
0
votes
0answers
41 views
script- loop through files and directories
I have written the script, which unzips a zip file (passed as argument to the bash), loops through directory and files, then perform different actions based on directory or file. It is working fine.
...
0
votes
0answers
47 views
Push backup script
I just wrote a little bash script for rsync push backups of my laptop to my Synology-Diskstation at home. See the code below. Since I am a bash beginner and don't have any experience with ssh, rsync ...
1
vote
1answer
29 views
Input Columns with Awk
I wrote a small script to manipulate fields of a file based on the input of a user. Is there something I could've done better, or perhaps a better refactor? I do know however that I need a way to ...
1
vote
2answers
59 views
Bash log monitoring optimization
I've made a Bash script to monitor some server log files for certain data and my method probably isn't the most efficient.
One section specifically bugs me is that I have to write a newline to the ...
1
vote
1answer
111 views
bash script to organize files and cleanup files
I have been working on a bash script for a while now to organize my movie files. I can do it by hand, but at the time I was taking a bash scripting class and thought I would like to use it to create ...
0
votes
0answers
24 views
crontab+script does not exit at end of process
I've create the backup script below, and added it to crontab using the latest webmin.
Problem: The script doesn't exit, which results in several rsync threads being visible in top after a few days. ...
0
votes
0answers
53 views
Directory's disk usage list
For my classes i had to finish this task.
Problem 5.5 Directory's disk usage list
For indicated directory print a list of files and subdirectories in descending order according to their total disk ...
2
votes
1answer
311 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 negative; 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
124 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
66 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
52 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
176 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
319 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
33 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
156 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
163 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
92 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
121 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
40 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
80 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
85 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 ...
3
votes
1answer
108 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
149 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
122 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
69 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
104 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
105 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 ...
3
votes
1answer
163 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
133 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
146 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
334 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
204 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
1k 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
358 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
156 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
1k 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
947 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
1k 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
357 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
103 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
408 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
424 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 ...