Questions tagged [bash]

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.

Filter by
Sorted by
Tagged with
1
vote
1answer
915 views

Bash script for reverse-engineering Android applications

I'm new to bash scripting and need some help improving 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
436 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 ...
5
votes
1answer
7k 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! ...
3
votes
1answer
4k views

Bash arrays and case statements - review my script

...
3
votes
2answers
219 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. ...
2
votes
3answers
3k views

Bash script to swap out, edit host files

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 allow ...
4
votes
2answers
4k 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. <...
3
votes
1answer
7k 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 ...
1
vote
2answers
546 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 ...
4
votes
2answers
980 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 ...
6
votes
3answers
1k 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 ...
3
votes
2answers
90 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 ...
6
votes
2answers
280 views

Printing a directory's contents in a loop

I wrote a bash script to print contents of files in a given directory in a loop. How can I improve command line parameters handling to the script? I feel the parameter processing as of now uses too ...
6
votes
3answers
286 views

Symlinking shared libraries from a platform-specific directory

We have a setup script for setting up a development environment, and setting up the image libraries is getting a bit messy: ...
1
vote
1answer
179 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
94 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
94 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
2answers
747 views

Adding a zero to file names

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 a zero before the single digit in file names. Can this be ...
6
votes
1answer
275 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 ...
3
votes
3answers
2k views

bash script for printer administration

...
7
votes
4answers
439 views

Making this password search more intelligent

In a homework, there is an exercise in which I have a script that is used to search for a password. One of the questions is if is possible to make it "more intelligent", and I'm stuck on it. ...
3
votes
1answer
197 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
456 views

Calling a script with a setuid set

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 ...
2
votes
1answer
255 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 ...
3
votes
2answers
1k 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
203 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 ...
5
votes
1answer
5k views

Is this a decent way of writing a start-stop-daemon script?

This is the first time I've written a start-stop-daemon script, so I would love some feedback. :) The goal is to have it start late, when the network and everything is ready. I also have 2 other start-...
12
votes
2answers
1k views

'find' template for handling any file

After growing tired of all the ways in which a file loop can be broken (find -print | while read) or unreadable (find -exec with ...
13
votes
3answers
1k views

Was this shell script ready for open-source? (Random XKCD wallpaper)

I wrote the following little shell script and published it on GitHub. In the repo there's also a README file that explains how to use it in more detail. This is the first time I open-sourced/...